Remove logon and Command records from Ubuntu

Source: Internet
Author: User
#1 Enter last | more in the terminal to view the "Logon/logout/restart" history, including the date and user information. #2 the records of Successful Logon/logout are stored in "/var/log/wtmp", and the records of Logon failures are stored in "/var/log/btmp. To delete logon records, you only need to delete these two files. Method: sudo-iecho & gt;/var/log/wtmpecho & gt;/var/log/btmp #3

#1
Terminal Input

Last | more

You can view the "Logon/logout/restart" history, including the date, user, and other information.

#2
These records of Successful Logon/logout are stored in "/var/log/wtmp", and logon Failure records are stored in "/var/log/btmp. To delete logon records, you only need to delete these two files.

Method:

Sudo-I

Echo>/var/log/wtmp

Echo>/var/log/btmp

#3
To clear the command history, run

History-c

Or

Echo>./. bash_history

[Note], if you want to check it later, back up the history before clearing it. For example, export to a folder and save it for your reference and reference. You can run the following command:

Cat./. bash_history>/home/Bentutu/folder/cmdtxt

Replace "/home/Bentutu/folder/" with your path.

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.