Improve this answer. Michael Mrozek Michael Mrozek Can anyone confirm that already open shells will not rewrite the history they loaded at initialization, when closed? IIRC it only saves it on exit. Chris Down Chris Down k 22 22 gold badges silver badges bronze badges.
Ignore it. Community Bot 1. I got an error -bash: history: -d: option requires an argument , but it still worked? It runs the delete command continuously, until it fails with an error because there's is nothing more to delete.
Just ignore the error. This is not only onliner, but also the right simple answer. Yep don't be confused about the history: -d: option requires an argument error! The history file is then reloaded into memory. That's okay. Are you sure? Hydde87 Hydde87 2 2 bronze badges. This command will fill up your disk with duplicated history values. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.
This is great when you need to repeat a command or can't remember exactly how you executed a command in a previous session. However, this can also be seen as a security issue. What if someone gains access to your machine, opens a terminal window, and checks through your bash history to see what commands you've run?
Bash has a handy way to clear the history: issue the command history -c. There's a slight problem with that approach. Let me explain. When you have a terminal open, and you issue a command, it writes the command to the history file. So issuing history -c will clear the history from that file.
The problem comes about when you have multiple terminal windows open. Say you have two terminal windows open and you issue history -c from the first one and close that window. You then move to the second terminal window, and you type the exit command to close that window. Because you had a second bash window open, even after running the history -c command in the first, that history will be retained.
In other words, the history -c command only works when it is issued from the last remaining terminal window. If you want to remove the history file forcefully, prevent creating a history file, and terminate from the terminal, then run the following command. After that, if a new terminal is opened, then it will work from the blank history. The following command can also be used for deleting the current history information permanently and terminate from the terminal.
This article shows how bash history can be cleared and prevent storing history information permanently by using various bash commands.
But if the users work with sensitive data, then it is better to select those commands shown in this article to prevent storing history information permanently.
I am a trainer of web programming courses. I like to write article or tutorial on various IT topics.
0コメント