Understanding the "who" command
Net Llama!
netllama
Fri Aug 4 12:17:34 PDT 2006
According to the who man page, it obtains its output from /var/run/utmp
or /var/log/wtmp.
w obtains its information from /var/run/utmp exclusively.
So if you're getting different information from the two commands, I'd
guess that who is using /var/log/wtmp.
On Fri, 4 Aug 2006, 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 !
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J Friedman netllama at linux-sxs.org
LlamaLand http://netllama.linux-sxs.org
More information about the Linux-users
mailing list