欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux登录查看命令

程序员文章站 2022-04-28 17:35:12
...
一 查看登录用户信息
w 用户名
who 用户名
last
last默认是读取/var/log/wtmp文件数据
lastlog
lastlog命令默认是读取/var/log/lastlog文件内容
 
二 实战
[root@localhost media]# w
11:56:39 up 4:13, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.0.101 10:09 7.00s 0.49s 0.05s w
root tty1 11:56 7.00s 0.13s 0.13s -bash
[root@localhost media]# who
root pts/0 2017-07-15 10:09 (192.168.0.101)
root tty1 2017-07-15 11:56
[root@localhost media]# last
root tty1 Sat Jul 15 11:56 still logged in
root pts/0 192.168.0.101 Sat Jul 15 10:09 still logged in
root pts/0 192.168.0.101 Sat Jul 15 07:48 - 10:08 (02:19)
(unknown :0 :0 Sat Jul 15 07:44 - 09:46 (02:01)
reboot system boot 3.10.0-327.el7.x Sat Jul 15 07:43 - 12:01 (04:18)
root pts/0 192.168.0.101 Fri Jul 14 19:22 - down (02:08)
(unknown :0 :0 Fri Jul 14 19:12 - 21:30 (02:18)
reboot system boot 3.10.0-327.el7.x Fri Jul 14 19:11 - 21:30 (02:19)
root pts/0 192.168.0.100 Thu Jul 13 21:11 - down (00:16)
[root@localhost media]# lastlog
Username Port From Latest
root tty1 Sat Jul 15 11:56:33 +0800 2017
bin **Never logged in**
daemon **Never logged in**
adm **Never logged in**
lp **Never logged in**
sync **Never logged in**
shutdown **Never logged in**
halt **Never logged in**
mail **Never logged in**
operator **Never logged in**
games **Never logged in**
ftp **Never logged in**
nobody **Never logged in**
systemd-bus-proxy **Never logged in**
systemd-network **Never logged in**
dbus **Never logged in**
polkitd **Never logged in**
abrt **Never logged in**
unbound **Never logged in**
tss **Never logged in**
colord **Never logged in**
usbmuxd **Never logged in**
geoclue **Never logged in**
rpc **Never logged in**
rtkit **Never logged in**
chrony **Never logged in**
radvd **Never logged in**
qemu **Never logged in**
avahi-autoipd **Never logged in**
setroubleshoot **Never logged in**
rpcuser **Never logged in**
nfsnobody **Never logged in**
saslauth **Never logged in**
libstoragemgmt **Never logged in**
pulse **Never logged in**
gdm :0 Sat Jul 15 07:44:46 +0800 2017
gnome-initial-setup **Never logged in**
avahi **Never logged in**
sshd **Never logged in**
postfix **Never logged in**
ntp **Never logged in**
tcpdump **Never logged in**
cakin24 :0 Sat Nov 12 10:37:40 +0800 2016
 
相关标签: Linux 登录