1,760
edits
Changes
→Overview
Most system administrators would like to know the utilization of their systems by their users. On a Linux system, each user's login records are normally stored in the binary file /var/log/wtmp. The login records in this binary file can not be viewed or edited directly using normal Linux text commands like 'less', 'cat', etc. The 'last' command is often used to display the login records stored in this file in a human readable form. Please check the man page of the 'last' command for available options. The following is the contents of the file named "usage_data_file", which is a sample output of the 'last' command with the '-Fiw' flag on:
<pre>
$ last -Fiw> usage_data_file$ cat usage_data_file
rchan pts/9 10.40.91.236 Tue Feb 13 16:53:42 2018 - Tue Feb 13 16:57:02 2018 (00:03)
cwsmith pts/6 10.40.43.94 Tue Feb 13 16:51:47 2018 - Tue Feb 13 16:56:13 2018 (00:04) mlee18 pts/6 10.40.43.94 Tue Feb 13 16:50:20 2018 - Tue Feb 13 16:51:27 2018 (00:01) hfang pts/4 24.114.50105.50 Tue Feb 13 16:31:38 2018 - Tue Feb 13 17:48:39 2018 (01:17) 130 bigia pts/8 24.114.50.50 Tue Web Feb 13 1914 23:2809:43 12 2018 - Tue Thu Feb 13 2015 02:2811:31 23 2018 (0003:5902)
rchan pts/2 10.40.91.236 Tue Feb 13 16:22:00 2018 - Tue Feb 13 16:45:00 2018 (00:23)
rchan pts/5 10.40.91.236 Tue Feb 15 16:22:00 2018 - Tue Feb 15 16:55:00 2018 (00:33)
asmith pts/2 10.43.115.162 Tue Feb 13 16:19:29 2018 - Tue Feb 13 16:22:00 2018 (00:02)
tsliu2 pts/4 10.40.105.130 Tue Feb 13 16:17:21 2018 - Tue Feb 13 16:30:10 2018 (00:12)
</pre>
It is always desirable to have a daily, weekly, monthly usage reports by user or by remote host based on the above information.