Query who users currently logged on to the system
[Root @ lyy ~] # Who
Root tty1
Root pts/0 (192.168.197.1)
Login users in column 1
Terminal name in column 2
Column 3 Logon Time
Query the lastlog of the last logon time of each user.
[Root @ lyy ~] # Lastlog
User name port from last login time
Root pts/0 192.168.197.1 4. October 19:29:15 + 0800 2010
Bin ** never logged on **
Daemon ** never logged on **
Pcca tty1 22:09:21 + 0800 2010
Pcca1 tty1 22:09:26 + 0800 2010
Pcca 2 ** never logged on **
Lastlog reads data from the/var/log/lastlog file.
Write between users
Format: write user terminal interface
For example, a user's pc sends a message to the user's pcca.
1. view the interfaces of the pcca terminal on the pc terminal
[Pc @ lyy ~] $ Who
Root tty1
Pcca pts/0 (192.168.197.1) # The pcca Terminal interface is pts/0
Pc pts/1 (192.168.197.1)
2. Use write to send the message hello world
[Pc @ lyy ~] $ Write pcca pts/0
Hello world !!!
[Pc @ lyy ~] $
Press Ctrl + d.
3. view the situation of the pcca Terminal
[Pcca @ lyy ~] $
Message from pc @ lyy on pts/1...
Hello world !!!
EOF
If you do not want to accept the information, you can use mesg n to disable it. Information except root is not received.
Send broadcast information to all logged-in users. wall
[Pc @ lyy ~] $ Wall "I will shutdown my linux server ."
Broadcast message from pc (pts/1) (Thu Dec 9 19:47:35 2010 ):
I will shutdown my linux server.
In this way, all people can receive the message.
Author "Liyy Study Notes"