last is the command that you can make use of the get details of last login or reboots for users and ttys on a Unix or Linux distributions.
Example on macOS:% last
code2care ttys001 Mon Nov 7 17:02 still logged in
code2care ttys001 Mon Nov 7 16:04 - 16:04 (00:00)
code2care console Mon Nov 7 11:38 still logged in
reboot ~ Mon Nov 7 11:36
code2care ttys000 Sat Nov 5 16:08 - 16:08 (00:00)
code2care console Thu Nov 3 11:33 - 23:41 (3+12:08)
reboot ~ Thu Nov 3 11:31
code2care ttys001 Wed Nov 2 18:13 - 18:13 (00:00)
code2care console Tue Nov 1 11:05 - 01:09 (1+14:04)
reboot ~ Tue Nov 1 11:02
shutdown ~ Tue Nov 1 01:07
code2care ttys002 Mon Oct 31 19:10 - 19:10 (00:00)
wtmp begins Fri Oct 21 16:08
Command to know a specific user details
To find details for a specific user, you can pass in the username as a parameter,
Example on Ubuntu Linux Server:# last root
last code2care
root ttys001 Mon Nov 7 17:02 still logged in
root ttys001 Mon Nov 7 16:04 - 16:04 (00:00)
root ttys000 Mon Nov 7 13:02 still logged in
root ttys001 Mon Nov 7 12:56 - 12:56 (00:00)
root ttys000 Mon Nov 7 11:46 - 11:46 (00:00)
root console Mon Nov 7 11:38 still logged in
root ttys000 Sat Nov 5 16:08 - 16:08 (00:00)
wtmp begins Fri Oct 21 16:08
Command to know Last reboot times
# last reboot
reboot ~ Mon Nov 7 11:36
reboot ~ Thu Nov 3 11:31
reboot ~ Tue Nov 1 11:02
reboot ~ Thu Oct 27 11:29
reboot ~ Mon Oct 24 10:29
reboot ~ Fri Oct 21 16:08

-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Linux,
- Rename a directory using Linux/Unix command
- ls command to list only directories
- How to Restart or Reload Nginx Server Service on Linux
- 3 ways to clear screen on Linux Terminal
- ls command: sort files by name alphabetically A-Z or Z-A [Linux/Unix/macOS/Bash]
- Copy entire directory using Terminal Command [Linux, Mac, Bash]
- Fix: sudo: unable to open Read-only file system
- Create Hidden File or Directory using Shell Command
- Command to know the installed Debian version?
- The Date Command and its usage [Linux - Unix - macOS]
- Fix - bash: man: command not found
- How to tar.gz a directory or folder Command
- How to Display content of a file in Terminal Screen?
- How to change bash terminal prompt string and color
- Sort ls command by last modified date and time
- Execute .bin and .run file Ubuntu Linux
- zsh hello world example
- How to check uptime of Linux/Unix/macOS system/server using console command?
- [Fix] Linux - bash: useradd: command not found
- Command to check Last Login or Reboot History of Users and TTYs
- How to install and Configure sar sysstat tools in Ubuntu Linux
- How to use SCP Command to Copy Directory
- Linux Remove or Delete Files and Directories using Terminal Commands
- How to connect to SSH port other than default 22
- Install OpenSSL on Linux/Ubuntu
More Posts:
- Show Desktop Keyboard Shortcut on Mac - MacOS
- [Mac] Localhost at port 80 says It Works! - MacOS
- How to Run PowerShell Script (.ps1) on Mac - MacOS
- W3 : character data is not allowed here html validation error - Html
- How to turn off auto period after double-space on Mac - MacOS
- How to change user image icon macOS Big Sur - MacOS
- How to Upload a File to Google Colab (txt, csv, json, xml, xlsx) - Google
- Android : Exception raised during rendering: action_bar API 22 - Android