Home >Operation and Maintenance >Linux Operation and Maintenance >Clear historical commands recorded in history under Linux

Clear historical commands recorded in history under Linux

藏色散人
藏色散人forward
2020-01-31 17:51:373360browse

The following column Linux Tutorial will introduce to you how to clear the historical commands recorded in the history in the Linux environment. I hope it will be helpful to friends in need!

Clear historical commands recorded in history under Linux

1. History

This command can view the history commands used

Clear historical commands recorded in history under Linux

2. History -c

This command and parameters can clear the history command record

View again

The command record is empty

Remarks: Knowledge expansion

This command only deletes the command records of the current user and will not delete those of other users.

In fact, these records are in files similar to .bash_history in the current user's home directory. Of course, it depends on what shell you use.

For example: vim ~/.bash_history Open the historical command record file under the current user.

cat or vim ~/.bash_history View the contents of the file

The above is the detailed content of Clear historical commands recorded in history under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:oschina.net. If there is any infringement, please contact admin@php.cn delete