查询用户信息的几个常用命令

1、who查询当前在线用户

[root@beryl ~]# who
root     tty1         2011-04-16 02:11
root     pts/0        2011-04-16 07:05 (192.168.200.146)


2、w:查询当前在线用户的详细信息

 [root@beryl ~]# w
 07:54:32 up  5:43,  2 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     -                02:11    5:08m  0.03s  0.03s -bash
root     pts/0    192.168.200.146  07:05    0.00s  0.34s  0.04s w
 

3、groups:查询用户所属的组

[root@beryl ~]# groups
root bin daemon sys adm disk wheel


4、id:显示当前用户信息

[root@beryl ~]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
5、finger:查询用户信息

[root@beryl ~]# finger
Login     Name       Tty      Idle  Login Time   Office     Office Phone
root      root       tty1     5:12  Apr 16 02:11
root      root       pts/0          Apr 16 07:05 (192.168.200.146)

6、last:列出最近的用户登录

[root@beryl ~]# last
root     pts/0        192.168.200.146  Sat Apr 16 07:05   still logged in
root     pts/0        192.168.200.146  Sat Apr 16 02:46 - 07:04  (04:18)
root     pts/0        192.168.200.146  Sat Apr 16 02:12 - 02:45  (00:33)
root     tty1                          Sat Apr 16 02:11   still logged in
reboot   system boot  2.6.18-128.el5   Sat Apr 16 02:11          (05:47)
root     pts/0        192.168.200.146  Fri Apr 15 10:05 - 10:51  (00:45)
root     tty1                          Fri Apr 15 10:05 - down   (00:46)
7、lastlog:列出每一个用户的最近登录情况

[root@beryl ~]# lastlog
Username         Port     From             Latest
root             pts/0    192.168.200.146  Sat Apr 16 07:05:07 -0800 2011
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**
news                                       **Never logged in**
uucp                                       **Never logged in**
operator                                   **Never logged in**
games                                      **Never logged in**
gopher                                     **Never logged in**
ftp                                        **Never logged in**
nobody                                     **Never logged in**
rpc                                        **Never logged in**
mailnull                                   **Never logged in**
smmsp                                      **Never logged in**
nscd                                       **Never logged in**
vcsa                                       **Never logged in**
rpcuser                                    **Never logged in**
sshd                                       **Never logged in**
pcap                                       **Never logged in**
ntp                                        **Never logged in**
dbus                                       **Never logged in**
haldaemon                                  **Never logged in**
avahi                                      **Never logged in**
avahi-autoipd                              **Never logged in**
dovecot                                    **Never logged in**
mysql                                      **Never logged in**
named                                      **Never logged in**
xfs                                        **Never logged in**
gdm                                        **Never logged in**
sabayon                                    **Never logged in**
ro                                         **Never logged in**
natasha                                    **Never logged in**
redhat1                                    **Never logged in**
 

你可能感兴趣的:(常用命令,职场,休闲,查询用户信息)