码迷,mamicode.com
首页 > 系统相关 > 详细

Linux下查看在线用户及用户进程

时间:2015-08-20 06:51:04      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:用户

可采用命令:w,who,last,users,finger(需yum安装)

法一:
[root@test1 ~]# who
root     tty1         2015-08-19 23:15
lxh      pts/0        2015-08-20 00:10 (192.168.150.1)
法二:
[root@test1 ~]# w
 00:11:36 up 56 min,  2 users,  load average: 0.00, 0.02, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     -                23:15   56:01   0.01s  0.01s -bash
lxh      pts/0    192.168.150.1    00:10    0.00s  0.02s  0.02s sshd: lxh [priv]
法三:
[root@test1 ~]# finger
Login     Name       Tty      Idle  Login Time   Office     Office Phone
lxh                  pts/0          Aug 20 00:10 (192.168.150.1)
root      root       tty1       56  Aug 19 23:15
法四:
[root@test1 ~]# users
lxh root
法五:
[root@test1 ~]# last | head -n 5
lxh      pts/0        192.168.150.1    Thu Aug 20 00:10   still logged in   
lxh      pts/1        192.168.150.1    Wed Aug 19 23:36 - 00:10  (00:34)    
lxh      pts/0        192.168.150.1    Wed Aug 19 23:16 - 00:10  (00:54)    
root     tty1                          Wed Aug 19 23:15   still logged in   
reboot   system boot  2.6.32-504.el6.x Wed Aug 19 23:15 - 00:12  (00:56)

查看某用户
当登陆系统用户很多的时候,可以在w后面加上某个用户名,则会查看该用户执行任务的情况

[root@test1 ~]# w lxh
 00:21:08 up  1:06,  2 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
lxh      pts/0    192.168.150.1    00:10    0.00s  0.03s  0.02s sshd: lxh [priv]

【查看进程】

[root@test1 ~]# ps -ef | grep sshd
root       927     1  0 Aug19 ?        00:00:00 /usr/sbin/sshd
root      1905   927  0 00:10 ?        00:00:00 sshd: lxh [priv] 
lxh       1908  1905  0 00:10 ?        00:00:00 sshd: lxh@pts/0  
root      2047  1946  0 00:22 pts/0    00:00:00 grep --color=auto sshd

[root@test1 ~]# ps aux | grep sshd
root       927  0.0  0.1  66688  1216 ?        Ss   Aug19   0:00 /usr/sbin/sshd
root      1905  0.0  0.4  98376  4228 ?        Ss   00:10   0:00 sshd: lxh [priv] 
lxh       1908  0.0  0.1  98376  1936 ?        S    00:10   0:00 sshd: lxh@pts/0  
root      2057  0.0  0.0 103260   844 pts/0    S+   00:23   0:00 grep --color=auto sshd


Linux下查看在线用户及用户进程

标签:用户

原文地址:http://xoyabc.blog.51cto.com/7401264/1686251

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!