≡ Menu

last command

I am a new Unix system admin. How do I find ouw who has recently use the Linux or Unix-like server? Which terminals they used, and when they logged in and out of the my server?
[click to continue…]

Linux Reboot Command Example

How do I reboot my HP Linux server using command line option? How do I remotely reboot my CentOS or Debian based Linux server?
[click to continue…]

HowTo: Shutdown Linux System

I'm a new Linux user. How do I shutdown Linux based system using command line options?
[click to continue…]

Shutdown Linux Server

How do I shutdown my Linux server or computer using command line option?
[click to continue…]

Linux Display Date And Time Of Login

How do I display user last login date and time under Linux operating systems?
[click to continue…]

Q. I'd like to monitor my UNIX / Linux server reboot / shutdown usage. How do I get more information about reboot and shutdown command?

A. There is a file called /var/log/wtmp. The pseudo user reboot logs in each time the system is rebooted. Thus last reboot will show a log of all reboots since the log file was created.

wtmp also contains information about reboots and shutdowns, you can list that information, by typing the following command at the shell prompt:
$ sudo last reboot
OR
# last reboot
Output:

reboot   system boot  2.6.22-14-generi Wed Oct 24 08:03 - 08:48  (00:44)
reboot   system boot  2.6.22-14-generi Tue Oct 23 21:21 - 00:40  (03:18)
reboot   system boot  2.6.22-14-generi Tue Oct 23 14:29 - 19:55  (05:26)
reboot   system boot  2.6.22-14-generi Mon Oct 22 18:36 - 19:55 (1+01:19)
reboot   system boot  2.6.22-14-generi Mon Oct 22 17:05 - 19:55 (1+02:50)
reboot   system boot  2.6.22-14-generi Mon Oct 22 14:50 - 17:03  (02:13)
reboot   system boot  2.6.22-14-generi Mon Oct 22 13:28 - 13:29  (00:01)
reboot   system boot  2.6.22-14-generi Mon Oct 22 13:07 - 13:27  (00:20)
reboot   system boot  2.6.22-14-generi Sun Oct 21 14:38 - 08:20  (17:42)
reboot   system boot  2.6.22-14-generi Sat Oct 20 10:53 - 12:54 (1+02:00)
reboot   system boot  2.6.22-14-generi Fri Oct 19 21:18 - 01:41  (04:22)
reboot   system boot  2.6.22-14-generi Fri Oct 19 16:07 - 01:41  (09:34)
reboot   system boot  2.6.22-14-generi Thu Oct 18 22:56 - 12:32  (13:35)
reboot   system boot  2.6.22-14-generi Thu Oct 18 14:30 - 12:32  (22:01)

You can also type the following command to get halt / shutdown time only:
$ last -x | grep down
Output:

vivek    tty1                          Mon Oct 22 13:25 - down   (00:01)
vivek    tty7         :0               Mon Oct 22 13:08 - down   (00:19)
vivek    tty1                          Thu Oct 18 14:25 - down   (00:04)
vivek    tty7         :0               Thu Oct 18 14:24 - down   (00:04)
vivek    tty1                          Thu Oct 18 14:16 - down   (00:00)
vivek    tty1                          Thu Oct 18 14:13 - down   (00:02)

Linux Remove or Clear the Last Login Information

I am a Fedora Linux user (SysAdmin) and I would like to clear all the login information. How do I clear or remove last login information on Linux operating systems?
[click to continue…]