How To view/var/log/wtmp files in Linux

Source: Internet
Author: User

In Linux, the/var/log/wtmp file method/var/log/wtmp file function/var/log/wtmp is also a binary file, records the logon times and duration of each user. This log file permanently records the logon, logout, and system startup and shutdown events of each user. Therefore, as the system runs normally, the file size increases, depending on the number of system user logins. This log file can be used to view the user's logon records. The last command obtains this information by accessing this file and displays the user's logon records in reverse order, last can also display corresponding records based on the user, terminal tty or time. View method: You can use the last command to output the following content: debian: /var/log # lastdebian pts/9 221.215.176.148 Thu Oct 17 still logged in debian pts/8 running Thu Oct 17 still logged in debian pts/7 running Thu Oct 17-) root pts/5 114.20.31.253 Thu Oct 17-() root pts/4 114.20.31.253 Thu Oct 17 ).... or use the last-f/var/log/wtmp last command: Function Description: lists the current and past logon systems. User-related information. Syntax: last [-adRx] [-f] [-n] [account name...] [terminal number...] note: Execute the last command separately. It will read the file named wtmp in the/var/log directory, and display all the usernames of the login system recorded in the file. Parameter:-a displays the host name or IP address from which to log on to the system in the last row. -D. Convert the IP address to the host name. -F specifies the record file. -N or-set the number of columns displayed in the list. -R does not display the host name or IP address used to log on to the system. -X displays information such as system shutdown, reboot, and change of execution level.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.