The status commands are UNIX commands, not specific shell commands.
|date||Displays the current (system) date and time|
|ps||Displays information about system processes|
|who||Display which users are logged in to the system|
|rusers||Displays the users on local area network (LAN) systems|
|finger||Displays information about logged-in users|
|uptime||Displays how long the system has been up|
|rup||Displays how long LAN systems have been up (uptime for all network systems)|
|w||Displays the output of the uptime command and then displays a list of the current activity on the system and what each user is doing|
The date Command
If you create a script that writes a report, you might want the date and time to appear as an entry in the file. The date command prints a one-line output of the current date and time (system date and time).
# date Tue Jun 9 11:36:00 UTC 2020
The ps Command
The ps command displays the current processes for the executing user.
# ps PID TTY TIME CMD 2281 pts/0 00:00:00 sudo 2285 pts/0 00:00:00 su 2286 pts/0 00:00:00 bash 2477 pts/0 00:00:00 ps
The following table describes the meaning of the columns in the ps output.
|PID||The numerical process ID number|
|TTY||The terminal number from which the process was initiated|
|TIME||Shows how much central processing unit (CPU) time the process has consumed|
|CMD||The name of the command that the process is executing|
|UUID||The name of the user that started the process|
|PPID||The parent process ID|
|C||The processor utilization for scheduling (obsolete)|
|STIME||The day the process was started|
As shown in the following example, some options to the ps command expand the information that is displayed. The -f option displays the full listing and includes such information as the user’s login name, the process identification number (PID), the parent’s PID, and so on. The -e option displays all the processes on the system. You can combine these options.
# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 11:29 ? 00:00:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 root 2 0 0 11:29 ? 00:00:00 [kthreadd] root 4 2 0 11:29 ? 00:00:00 [kworker/0:0H] root 5 2 0 11:29 ? 00:00:00 [kworker/u4:0] root 6 2 0 11:29 ? 00:00:00 [ksoftirqd/0] root 7 2 0 11:29 ? 00:00:00 [migration/0] root 8 2 0 11:29 ? 00:00:00 [rcu_bh] root 9 2 0 11:29 ? 00:00:00 [rcu_sched] root 10 2 0 11:29 ? 00:00:00 [lru-add-drain] root 11 2 0 11:29 ? 00:00:00 [watchdog/0] root 12 2 0 11:29 ? 00:00:00 [watchdog/1] root 13 2 0 11:29 ? 00:00:00 [migration/1] root 14 2 0 11:29 ? 00:00:00 [ksoftirqd/1] root 16 2 0 11:29 ? 00:00:00 [kworker/1:0H] ...
The who Command
In preparation for system administration tasks, it is important to know who is currently working on the system. The who command displays the list of currently logged-on users, at which terminal they are logged in, and the date and time they logged in.
# who geek_user pts/0 2020-06-09 11:33 (192.168.1.39) mike pts/0 2020-06-09 10:21 (192.168.1.77)
The rusers Command
The rusers command polls the LAN and prints a list of all currently logged-in users. If a system does not have any logged-in users, no users are displayed in the list. The rusers command, however, forces all systems to be displayed, whether they have current users or not. Options also control the order of the display (sorted by system, sorted by user, and so on). The rusers command sometimes takes a long time to terminate. The information is printed quickly, but then the command pauses as if it is still searching for more users. Nothing usually prints after this, so you can kill the command with a Control-C (interrupt character).
# rusers Sending broadcast for rusersd protocol version 3... system01 mike system09 john system100 root milton
The finger Command
The finger command lists information about the users logged into the current system. The fields of information are:
- The login name of the user
- The real name of the user (as defined in the /etc/passwd file)
- The terminal to which the user is logged in
- The idle time (the amount of time since any keyboard activity was detected)
- When the user logged in
- Where the user logged in from (if the user remotely logged in from another system on the network)
# finger cloud_user Login: cloud_user Name: Directory: /home/cloud_user Shell: /bin/bash On since Tue Jun 9 11:33 (UTC) on pts/0 from 192.168.132.21 3 seconds idle No mail. No Plan.
The uptime Command
# uptime 11:51:38 up 22 min, 1 user, load average: 0.00, 0.05, 0.06
The rup Command
The rup command is similar to performing an uptime command for all systems on the LAN. The information is the same, except for these differences:
- The name of the system is listed first
- The date is not listed
- The number of users is not listed
$ rup system01 up 7 days, 6:47, load average: 0.21, 0.21, 0.21 system09 up 4:20, load average: 0.21, 0.26, 0.26 system11 up 15:53, load average: 0.20, 0.16, 0.14 system19 up 2 days, 2:44, load average: 0.00, 0.00, 0.01
The w Command
The w command first displays the output of the uptime command. Then the w command displays a list of the current activity on the system and what each user is doing. It gives the following information:
- The user’s login name
- The terminal at which the user logged in
- The time the user logged in
- The amount of time the user has been idle
- The joint CPU (JCPU) time that all the processes of that terminal have consumed
- The process CPU (PCPU) time that the currently active processes have consumed
- The name and arguments of the current process
# w 11:55:09 up 25 min, 1 user, load average: 0.00, 0.03, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT cloud_us pts/0 18.104.22.168 11:33 5.00s 0.23s 0.17s sshd: cloud_user [priv]