Tim Bolz wrote,
>Is there a log file when I started X and when I quit X?  I would like
>to know how long I was on and other user on the system.  I know in
>bash you can do who but that tells who is online at that time and how
>long they have been on.  If there isn't a command to say who is on X
>or how long someone has been online.  Sometimes it seems like I've
>been on a short time and 4 hours have passed.  Is there a time online
>for the launcher panel?  If not it would be a good thing.  I know
>there is a program which locks the screen for a time so you can take a
>break. I would like a log to say. Timothy logged in at 9:30 am
>Msy31,2009 and logged off at 11:30pm May31,2009.  A list like this
>would be useful  I'm sure perl or python could do the job.

There is an X log file (/var/log/Xorg.0.log), but it's not very useful for
this purpose, since it doesn't record times.

Fortunately that's not the only option.  Open up a terminal window, and
type this:

     last -10

This shows the ten most recent logins on your machine (most recent at the
top), along with the logout time if they're not still logged in, and the
total time at the end in parentheses.  It's designed to record logins on
the text console (or Xterm window), but in some distributions it also
records X sessions.

For example, my system is configured to boot straight into X, and to
record X sessions for "last".  Here's what I get when I type "last -10":

   nparker  pts/1        :0.0             Sun May 31 22:12   still logged in   
   nparker  pts/0        :0.0             Sun May 31 21:17   still logged in   
   nparker  :0                            Sun May 31 21:17   still logged in   
   reboot   system boot  2.6.26.2         Sun May 31 21:17          (01:11)    
   nparker  pts/0        :0.0             Sun May 31 16:06 - 18:48  (02:41)    
   nparker  :0                            Sun May 31 16:06 - 18:48  (02:42)    
   reboot   system boot  2.6.26.2         Sun May 31 16:05          (02:43)    
   nparker  pts/0        :0.0             Sat May 30 20:12 - 00:03  (03:50)    
   nparker  :0                            Sat May 30 20:12 - 00:03  (03:51)    
   reboot   system boot  2.6.26.2         Sat May 30 20:11          (03:51)    
   
   wtmp begins Fri May  1 00:25:41 2009

The top three rows are my current session--the top two rows are Xterm
windows, and the third row is my current X session.  The sixth row (and
all rows below it that have ":0" in the second column) is the one with the
information you're interested in--it shows that I logged in at 4:06 PM
this afternoon, and logged out at 6:48 PM, for a total login time of two
hours and 42 minutes.

Whether or not your system records X sessions for "last" might depend on
what desktop environment you're using.  KDE's login window ("kdm") does
it (unless you manually add the line "UseSessReg=false" to its
configuration file), but I don't know about Gnome's login window ("gdm").

By the way, if you leave off the "-10", and just type "last", it will show
you ALL the logins since it first started keeping track.  Depending on
how your system is configured, this could be a LONG list...I recommend
piping it through "|more" or "|less".

(The login/logout record is kept in the file /var/log/wtmp.  Alas, it's a
binary file, which is why there are special commands like "last" for
viewing it.)

               - Neil Parker
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to