Linux system functions
1.1 function Query
In Linux man page, system functions are stored in the second section. For functions of the standard function library, they are stored in the third section;
Run the following command to query:
# Man-S 3 sysinfo
No manual entry for sysinfo
# Man-S 2 sysinfo
Information about sysinfo
1.2 restrictions on the use of system functions
Because the Linux operating system has a strict security mechanismProgramWhen using the system to call functions, there may be many restrictions.
2. Obtain and set system information
2.1 obtain the name, version, URL, and computer type of the operating system.
When writing a program, a good program designer may make different considerations based on the executed hardware and operating system. you can use the uname () function to obtain the operating system name, version, URL (including host name), and computer type (such as intel6x86 compatible machine lines) of the current host.
2.2 obtain and set the website
Gethostname ();
Sethostname ();
2.3 obtain the system running status
Sysinfo ();
2.4 obtain the file system status
Statfs ();
3. file and directory management
3.1 obtain the File status
Stat ();
Lstat ();
3.2 change file permissions and owner
Chmod (); change File Permissions
Chown (); change the owner or group of the file
3.3 create file links and symbolic links
Link (); Create a symbolic link
Symlink (); Create a symbolic link
3.4 delete an object
Unlink ();
3.5 create and delete a directory
Mkdir ();
Rmdir ();
3.6 obtain and switch the working directory
Access
Chdir
Fchdir
Fchmod
Fchown
Lchown
Chroot
Fstatfs
Readdir
Getdents
Rename
Readlink
Mount
Umount
Ustat
Utime
Utimes
Quotactl