The command under experiences on common (not system) customers – people with residence directories in /residence – and counts their logins.
$ for consumer in `ls /residence` > do > echo -n "$consumer: " > who /var/log/wtmp | grep "^$consumer " | wc -l > achieved brie: 0 dumdum: 0 fedora: 124 george: 1 justme: 0 lola: 19 newuser: 0 shs: 90
To get an concept how outdated the wtmp file is, you may run a command like this one which shows the primary (and, thus, oldest) line within the file.
$ who /var/log/wtmp | head -1 shs pts/3 2024-04-02 16:24 (192.168.0.11)
Additionally, you will see the beginning date of the wtmp file while you run a command like this one the place that info is tacked on on the finish of the output.
$ final george george pts/2 192.168.0.8 Tue Jul 30 15:32 - 15:32 (00:00) wtmp begins Tue Apr 2 16:24:11 2024
The ac command
The ac command experiences on consumer join time, and it has quite a lot of different helpful choices as effectively.
Use the -d choice to view day by day login totals as on this instance:
$ ac -d | tail -5 Aug 27 complete 222.68 Sep 7 complete 4.60 Sep 10 complete 1.85 Sep 13 complete 18.43 In the present day complete 26.73
For consumer totals, use the -p choice: