View the history command and history command

Source: Internet
Author: User

View the history command and history command

Files have been cleared during production. Which of the following operations can be checked?

 

Use history to view historical commands:

$ History | more

 

You can also run the following command to view the history:

$ Vi ~ /. Bash_history

 

Only historical commands are displayed. For example, check who logged on to the system and executed these commands?

View User Login system information

$ Last

 

Run the following command:

$ Export HISTTIMEFORMAT = '% F % t' $ history | more

However, in this way, the command after HISTTIMEFORMAT is set will display the correct time, and the previous command will not display the correct time.

 

Confirm the command that causes the file content to be cleared. The similar content is as follows:

Lrwxrwxrwx. 1 root 6 Jul 22 wc-link.txt-> wc.txt

Ls is used to display detailed information, but the display result is accidentally used as a command for execution. The file is soft link and the redirection is executed. The result is that the file is cleared.

However, no final confirmation is made, because everyone uses the same user operation and is not associated with the IP address. What's your best solution?

 

Operate the linux terminal and use [Ctrl] + [R] To search for historical commands.

 

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.