Home  >  Article  >  Operation and Maintenance  >  What is the command to clear history in linux?

What is the command to clear history in linux?

WBOY
WBOYOriginal
2022-01-13 15:46:3018407browse

In Linux, the command to clear history is "history -c"; the function of the history command is to record the executed commands. When the parameter is set to "-c", it means that the history output of the current window can be cleared. Order.

What is the command to clear history in linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the command to clear history in Linux

history [-c] [-d offset] [n]

or history -anrw [file name]

or history -ps parameter [parameter...]

-c: Clear the command history in the memory, but will not clear the history file Record

-d: Delete the specified command history record, and will not clear the records in the history file

-r: Read historical commands from the historical command file into the memory

-w: Append the historical commands in memory to the historical command file

Use the -c option to clear all command history

If you want to clear all command history, you can execute:

# history -c

This command can clear all the output commands of this login, but it does not clear the .bash_history file, so after the next login, the old commands will still appear, and the historical commands exist in the current user root directory./bash_history document.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What is the command to clear history in linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn