Understanding the "who" command

Ben Duncan bns
Fri Aug 4 13:36:25 PDT 2006


Comes from the /var/log/utmp:

SNIP from man who ...

"
  If  FILE is not specified, use /var/run/utmp.  /var/log/wtmp as FILE is
        common.  If ARG1 ARG2 given, -m presumed: `am i'  or  `mom  likes'  are
        usual.
"

Brad De Vries wrote:
> Hey all, I'm hoping that someone can give me a little insight into
> where the data comes from for the "who" command.  Here's what I'm
> seeing on my box right now:
> 
> ---------
> /home/bjd> who
> bjd      pts/0        Aug  4 13:55 (qad-gr)
> bjd      pts/2        May 30 15:53
> /home/bjd> ps -ft pts/2
> ps: error: TTY could not be found.
> usage: ps -[Unix98 options]
>        ps [BSD-style options]
>        ps --[GNU-style long options]
>        ps --help for a command summary
> /home/bjd> ps -ef | grep bjd
> bjd       1729  1727  0 13:55 ?        00:00:00 /usr/sbin/sshd
> bjd       1731  1729  0 13:55 pts/0    00:00:00 -bash
> bjd       1774  1731  0 13:56 pts/0    00:00:00 ps -ef
> bjd       1775  1731  0 13:56 pts/0    00:00:00 grep bjd
> /home/bjd> w
>  14:07:54  up 332 days,  3:45,  2 users,  load average: 0.01, 0.02, 0.00
> USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU  WHAT
> bjd      pts/0    qad-gr            1:55pm  0.00s  0.07s  0.01s  w
> ---------
> 
> You can clearly see that the "who" command shows two users but the
> "ps" and "w" commands only shows processes attached to one.
> 
> I could reboot the server but I'm hoping to achieve a full year of uptime.
> 
> Thanks,
> Brad.
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
> 
> Need to chat further on this subject? Check out #linux-users on irc.linux-sxs.org !
> 
> .
> 

-- 
Ben Duncan   - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor




More information about the Linux-users mailing list