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)
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |