This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
linux:users_logs [2022/11/21 14:11] manu |
linux:users_logs [2022/11/21 15:28] (current) manu |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Lastlog ===== | ===== Lastlog ===== | ||
| + | lastlog command prints the last login times for system accounts. Login information is read from the file /var/log/lastlog. | ||
| + | |||
| + | To print the last login of all the users: | ||
| + | <cli prompt='#'> | ||
| + | # lastlog | ||
| + | </cli> | ||
| + | |||
| + | To print the records of specified days older: | ||
| + | <cli prompt='#'> | ||
| + | # lastlog -b 10 | ||
| + | # lastlog --before 10 | ||
| + | </cli> | ||
| + | |||
| + | To print the logs more recent that specified days: | ||
| + | <cli prompt='#'> | ||
| + | # lastlog -t 20 | ||
| + | # lastlog --time 20 | ||
| + | </cli> | ||
| + | |||
| + | To print the last login records of specified login: | ||
| + | <cli prompt='#'> | ||
| + | # lastlog -u mike | ||
| + | # lastlog --user mike | ||
| + | </cli> | ||
| **Why is the /var/log/lastlog file so large?** | **Why is the /var/log/lastlog file so large?** | ||
| Line 18: | Line 42: | ||
| /dev/mapper/rhel-var 5.0G 2.4G 2.7G 47% /var | /dev/mapper/rhel-var 5.0G 2.4G 2.7G 47% /var | ||
| </cli> | </cli> | ||
| + | |||
| + | This file can potential give problems during backup, so ignore it. | ||