On 16Jul2007 05:40, Robert C Wittig <[EMAIL PROTECTED]> wrote:
| Felix T. Gomez, Jr. wrote:
| > Last command is very useful but it would be better if
| > I will know what file does this information resides?
| > 
| > What I am thinking is if the data resides in a file, I
| > could get it by making a perl script that will read a
| > "log file" and parse it line by line just like how i
| > could see it when I type the "last" command.
| 
| 'last' extracts its information from /var/log/wtmp as indicated in the 
| man page for the 'last' command I referred you to, but unfortunately, 
| 'wtmp' is a binary file, which cannot be directly read, which accounts 
| for the existence of 'last', which is the utility created to read from 
| 'wtmp'.

You can easily write a C program to read the utmp and wtmp files (they
are the same format, with utmp being the current logins and wtmp being
log of logins and logouts). See "man 5 utmp".

It would be easy to have this C program write text output and run like
"tail -f" (or just read from "tail -f /var/log/wtmp" with a pipe).

I used to have just such a program hooked up to list my friends in my
terminal's status line as they logged in and out (a multiuser shared system).

Cheers,
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

EMACS: Escape Meta Alt Control Shift


To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be 
removed. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/LINUX_Newbies/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/LINUX_Newbies/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to