大家应该都知道查询一个用户的数据,用id、finger
appledeMacBook-Pro:~ apple$ id
uid=501(apple) gid=20(staff) groups=20(staff),701(com.apple.sharepoint.group.1),12(everyone)
appledeMacBook-Pro:~ apple$ finger
Login Name TTY Idle Login Time Office Phone
apple apple *con 22d 1 30 20:07
apple apple s00 3d 1 30 20:07
apple apple s00 3d 2 1 10:01
apple apple s00 2 1 10:19
apple apple s00 1 2 3 10:00
apple apple s00 3d 2 4 12:18
那如果查询当前系统已登陆用户呢?用w和who查询
appledeMacBook-Pro:~ apple$ w
18:54 up 22 days, 22:47, 6 users, load averages: 1.88 2.01 2.06
USER TTY FROM LOGIN@ IDLE WHAT
apple console - 30 116 22days -
apple s000 - 30 116 3days python manage.py shell
apple s001 - 01 216 3days ./src/redis-server *:6379
apple s002 - 01 216 - w
apple s004 - 03 216 3 -bash
apple s005 - 04 216 3days mongo
appledeMacBook-Pro:~ apple$ who
apple console Jan 30 20:07
apple ttys000 Jan 30 20:07
apple ttys001 Feb 1 10:01
apple ttys002 Feb 1 10:19
apple ttys004 Feb 3 10:00
apple ttys005 Feb 4 12:18
用last查看每个账户最近登陆时间
appledeMacBook-Pro:~ apple$ last
apple ttys003 10.0.1.74 Thu Feb 18 15:46 - 15:47 (00:01)
apple ttys006 Sat Feb 6 21:57 - 21:57 (00:00)
apple ttys006 Sat Feb 6 21:57 - 21:57 (00:00)
apple ttys005 Thu Feb 4 12:18 still logged in