Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


The "last" command - List the last logged in users

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Linux Tips, Tricks, Tutorials
Author Message
caker



Joined: 15 Apr 2003
Posts: 2386
Location: Galloway, NJ

Posted: Thu Jun 26, 2003 9:52 pm    Post subject: The "last" command - List the last logged in users  

The "last" command displays when users logged into your system, when there were reboots and shutdowns, the kernel that was booted... Example:

Code: [root@li-20 root]# last
root     pts/1        zon122191aaa.def Thu Jun 26 14:36 - 15:25  (00:49)   
root     pts/0        zon122191aaa.def Thu Jun 26 13:11   still logged in   
root     pts/0        zon122191aaa.def Thu Jun 26 00:48 - 05:50  (05:01)   
root     tty0                          Tue Jun 24 16:59   still logged in   
reboot   system boot  2.4.21linode4-6u Tue Jun 24 16:58         (2+05:48)   

wtmp begins Tue Jun 24 16:58:25 2003
[root@li-20 root]#

It also displays where the user came from and what they connected to - (console, ftp, a terminal, etc). "tty0" is the console, where as pts (pseudo terminal) was an SSH or telnet session.

-Chris
Back to top  
caker



Joined: 15 Apr 2003
Posts: 2386
Location: Galloway, NJ

Posted: Fri Jun 27, 2003 8:00 pm    Post subject:  

If you get an error message that when you run "last" that /var/log/wtmp isn't found, execute the following command:

touch /var/log/wtmp

That will create the initial file.

-Chris
Back to top  
sec39



Joined: 17 Jun 2003
Posts: 47

Posted: Tue Jul 01, 2003 11:30 am    Post subject:  

Everytime I do the last command it says my wtmp file is this:

wtmp begins Tue Jul 1 11:40:40 2003

Is there any way so that it doesnt begin on every single day so that I can keep a running list? Thanks.
Back to top  
caker



Joined: 15 Apr 2003
Posts: 2386
Location: Galloway, NJ

Posted: Tue Jul 01, 2003 11:45 am    Post subject:  

sec39 wrote: Everytime I do the last command it says my wtmp file is this:

wtmp begins Tue Jul 1 11:40:40 2003

Is there any way so that it doesnt begin on every single day so that I can keep a running list? Thanks.
Is there a cron job that's recreating it?

Look for /etc/logrotate.conf and edit the wtmp section -- if it says "daily" change it to "monthly" ...

-Chris
Back to top  
sec39



Joined: 17 Jun 2003
Posts: 47

Posted: Tue Jul 01, 2003 11:59 am    Post subject:  

caker wrote: sec39 wrote: Everytime I do the last command it says my wtmp file is this:

wtmp begins Tue Jul 1 11:40:40 2003

Is there any way so that it doesnt begin on every single day so that I can keep a running list? Thanks.
Is there a cron job that's recreating it?

Look for /etc/logrotate.conf and edit the wtmp section -- if it says "daily" change it to "monthly" ...

-Chris

hah! word. its at monthly but ya.. today is the beginning of the month. :wink:
Back to top  
 
       Linode.com Forum Forum Index -> Linux Tips, Tricks, Tutorials
Page 1 of 1