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

Linux -- who whoami

时间:2014-08-29 21:14:59      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:des   cWeb   style   blog   os   java   io   strong   ar   

(一)

whoami  是一个相当简单的命令

bubuko.com,布布扣


(二)
 `who‘: Print who is currently logged in
============================================

`who‘ prints information about users who are currently logged on.
Synopsis:

     `who‘ [OPTION] [FILE] [am i]

   If given no non-option arguments, `who‘ prints the following
information for each user currently logged on: login name, terminal
line, login time, and remote hostname or X display.

   If given one non-option argument, `who‘ uses that instead of a
default system-maintained file (often `/var/run/utmp‘ or `/etc/utmp‘)
as the name of the file containing the record of users logged on.
`/var/log/wtmp‘ is commonly given as an argument to `who‘ to look at
who has previously logged on.

   If given two non-option arguments, `who‘ prints only the entry for
the user running it (determined from its standard input), preceded by
the hostname.  Traditionally, the two arguments given are `am i‘, as in
`who am i‘.

   Time stamps are listed according to the time zone rules specified by
the `TZ‘ environment variable, or by the system default rules if `TZ‘
is not set.  *Note Specifying the Time Zone with `TZ‘: (libc)TZ
Variable.

#记住用户的概念非常广泛,不仅仅指实际存在的用户,还包括各种特殊用户,一般id为 0 ~ 500

#参考/etc/passwd文件更深入理解用户的概念。
   The program accepts the following options.  Also see *note Common
options::.

 

I.
****************************************************************************************
`-a‘
`--all‘
     Same as `-b -d --login -p -r -t -T -u‘.
bubuko.com,布布扣

 

*************************************************************************************


`-b‘
`--boot‘
     Print the date and time of last system boot.    #最后一次系统启动的时间

bubuko.com,布布扣

#who -a 所显示的第一行

**************************************************************************************

`-r‘
`--runlevel‘
     Print the current (and maybe previous) run-level of the init
     process.
bubuko.com,布布扣

#who -a 所显示的第二行,运行级别

****************************************************************************************

`-l‘
`--login‘
     List only the entries that correspond to processes via which the
     system is waiting for a user to login.  The user name is always
     `LOGIN‘.

bubuko.com,布布扣

#who -a 正文的前六行,等待登录的用户端口

************************************************************************************************

`-u‘
     After the login time, print the number of hours and minutes that
     the user has been idle.  `.‘ means the user was active in the last
     minute.  `old‘ means the user has been idle for more than 24 hours.

bubuko.com,布布扣

#正文who -a 中的已登录的用户,给出 “登录地址” “登录时间” 还有其他一些数据

*************************************************************************************


`-w‘
`-T‘
`--mesg‘
`--message‘
`--writable‘
     After each login name print a character indicating the user‘s
     message status:

          `+‘ allowing `write‘ messages
          `-‘ disallowing `write‘ messages
          `?‘ cannot find terminal device

bubuko.com,布布扣

#显示是否可以用write命令去发送信息

***************************************************************************************

`-H‘
`--heading‘
     Print a line of column headings.

bubuko.com,布布扣

#这是个比较好的辅助命令,能提高显示结果的可读性

************************************************************************************

II

其他一些参数

1、显示dead processes 和 active processes
`-d‘
`--dead‘
     Print information corresponding to dead processes.

`-p‘
`--process‘
     List active processes spawned by init.
`-p‘
`--process‘
     List active processes spawned by init.

2、比whoami 稍微详细的结果

`-m‘
     Same as `who am i‘.

bubuko.com,布布扣

3、显示登录的用户总数

`-q‘
`--count‘
     Print only the login names and the number of users logged on.
     Overrides all other options.

 

4、其他
`--lookup‘
     Attempt to canonicalize hostnames found in utmp through a DNS
     lookup.  This is not the default because it can cause significant
     delays on systems with automatic dial-up internet access.

`-s‘
     Ignored; for compatibility with other versions of `who‘.

`-t‘
`--time‘
     Print last system clock change.


   An exit status of zero indicates success, and a nonzero value
indicates failure.

Linux -- who whoami

标签:des   cWeb   style   blog   os   java   io   strong   ar   

原文地址:http://www.cnblogs.com/IceSword-syy/p/3945669.html

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