Linux notes (6) Help commands and user management commands for common Linux commands
(1) man
The man command is used to obtain help information of a command or configuration file. The original English meaning is manual, and the path is/usr/bin/man. Its Syntax format is:
Man [command or configuration file]
Note: No absolute path is required to view the help information of the configuration file.
To view the help information of a command, you can view the command's purpose (NAME) and related options. The help information of a configuration file is mainly to view the storage information (NAME) and its corresponding format. Each configuration file in Linux has a corresponding format.
For example, view the ls command help, man ls, and view the help of the services configuration file under/ect: man services.
Special case: when viewing the passwd configuration document help, it displays the help information of the passwd command:
[root@localhost ~]# man passwdPASSWD(1) User utilities PASSWD(1)NAME passwd - update user’s authentication tokens SYNOPSIS passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username]
Then run the whereis command to view the passwd path:
[root@localhost ~]# whereis passwdpasswd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
We can see that there are two parts of passwd. In man1/passwd.1.gz, "1" indicates the help of the command, and in man5/passwd.5.gz, "5" indicates the help of the configuration file. Therefore, you can view the help of the configuration file as follows:
[root@localhost ~]# man 5 passwdPASSWD(5) Linux Programmer’s Manual PASSWD(5)NAME passwd - password fileDESCRIPTION Passwd is a text file, that contains a list of the system’s
(2) whatis
The whatis command can get a brief introduction to the command. It does not need to be completely displayed like man. Its format is:
Man [command]
For example, to display the brief help information of ls:
[root@localhost ~]# whatis lsls (1) - list directory contentsls (1p) - list directory contents
(3) apropos
The apropos command is used to view brief information about the configuration file. Its Syntax format is:
Apropos [configuration file]
For example, display the short help information of inittab under/etc:
[root@localhost ~]# apropos inittabinittab (5) - init daemon configuration
(4) -- help
Add-help to a command to display the main options of the command, such as the main options of the touch command:
[Root @ localhost ~] # Touch -- help usage: touch [Option]... file... changes the access time and modification time of each file to the current time. Files that do not exist will be created as empty files unless the-c or-h option is used. If the file name is "-", the access time of the file associated with the standard output is changed. Parameters required for long options are also required for short options. -A only changes the access time-c, -- no-create does not create any file-d, -- date = string uses the specified string to represent the time rather than the current time-f (ignore)
(5) help
The help command is used to obtain the help information of shell built-in commands. the built-in command is which, and the whereis command cannot find the command in the path. The help command is a built-in command, and its syntax format is:
Help [command]
For example, search for umask help:
[root@localhost ~]# help umaskumask: umask [-p] [-S] [mode] Display or set file mode mask.
Note: help can also view help information for shell programming such as if, case, and while.
(6) useradd
The useradd command is used to add a new user. The path is/usr/sbin/useradd. The syntax format is as follows:
Useradd [user name]
(7) passwd
The passwd command is used to set the user password. The path is/usr/bin/passwd. The syntax format is:
Passwd [user name]
Note: The password must comply with the password specifications.
(8) who
The who command is used to view login user information. The path is/usr/bin/who,
[root@localhost ~]# whoroot tty1 2015-01-07 22:30root pts/0 2015-01-07 22:37
The first root is the login user name, the second tty represents the local terminal, pts represents the remote terminal, and the last field is the login time.
(9) w
The w command is used to view the detailed information of the login user. The path is/usr/bin/w.
[root@localhost ~]# w16:31:16 up 2:45, 2 users, load average: 0.04, 0.02, 0.00USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATroot tty1 - Wed22 5days 0.63s 0.63s -bashroot pts/0 10.2.108.214 Wed22 0.00s 3.80s 0.01s w
"Up" indicates the continuous running time of the server. "load average" indicates the server load. "WHAT" indicates the command being executed by the current user. "JCPU" indicates the total CPU usage, PCPU indicates the CPU time occupied by the current command.