博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 下查看系统当前登录用户信息
阅读量:4568 次
发布时间:2019-06-08

本文共 1913 字,大约阅读时间需要 6 分钟。

当你新登录一个主机,过着管理一个主机,这时候你就需要这些命令来进行查看了:

1. w : Show who is logged on and what they are doing.

    w [options] user [...]

常用命令:

    w -h --no-header

    w -u --no-current

    w -s :   Use the short format.  Don't print the login time, JCPU or PCPU times.

    w -i, --ip-addr : Display IP address instead of hostname for from field.

2. who : Show who is logged on

   who -a, --all 展示所有的; 相当于 使用 -b -d --login -p -r -t -T -u

3. users: Print the user names of users currently logged in to the current host

4. whoami : Print effective userid

    Print the user name associated with the current effective user ID.  Same as id -un.

5. last : last, lastb - show a listing of last logged in users

    last -a 

    last [options] [username...] [tty...]

last  searches  back  through the /var/log/wtmp file (or the file designated by the -f option) and displays a list of all users logged in       (and out) since that file was created.  One or more usernames and/or ttys can be given, in which case last will  show  only  the  entries       matching those arguments.  Names of ttys can be abbreviated, thus last 0 is the same as last tty0.       When  catching  a  SIGINT  signal  (generated by the interrupt key, usually control-C) or a SIGQUIT signal, last will show how far it has       searched through the file; in the case of the SIGINT signal last will then terminate.       The pseudo user reboot logs in each time the system is rebooted.  Thus last reboot will show a log of all the reboots since the log  file       was created.       lastb is the same as last, except that by default it shows a log of the /var/log/btmp file, which contains all the bad login attempts.

 last reboot 展示所有的机器重新启动的情况。

6. lastb:lastb is the same as last, except that by default it shows a log of the /var/log/btmp file, which contains all the bad login attempts.

    在root 权限下,使用 lastb 命令,将会显示所有尝试登录失败的情况。

保持更新,转载请注明出处。

转载于:https://www.cnblogs.com/xuyaowen/p/user_login_info.html

你可能感兴趣的文章
JAVA Excel API学习案例
查看>>
网页打开速度慢的原因及N种解决方法
查看>>
监控线上服务的小脚本
查看>>
ultraedit 实际应用技巧
查看>>
mysql_select 单表查询
查看>>
磁盘配额
查看>>
dns视图搭建
查看>>
WPF 中动态改变控件模板
查看>>
ubuntu Ctrl+Alt+F1 进入终端字符界面 登录出现login incorrect解决办法
查看>>
珍爱生命,远离JS=>JS避坑记
查看>>
Bundle对象实现不同Activity之间数据传递
查看>>
TeamViewer 远程应用不显示,空白解决方案
查看>>
人机交互第五次作业
查看>>
linux下MySQL停止和重启
查看>>
Unity Particle System Sorting Order
查看>>
ANDROID_HOME on Mac OS X
查看>>
Real-Time Many-Light Management and Shadows with Clustered Shading
查看>>
.net代码修改webconfig
查看>>
1084 - Winter
查看>>
数组-join()
查看>>