I entered a password in a command line pro or in a terminal window by mistake and do not want to remove my whole history. My shell is bash.
How do I edit my bash history in Mac OS X?
bashcommand linehistorymacosterminal
I entered a password in a command line pro or in a terminal window by mistake and do not want to remove my whole history. My shell is bash.
How do I edit my bash history in Mac OS X?
Best Answer
Editing the
.bash_history
is just a matter of opening the file with an editor. There are a couple of ways you could achieve this.vi ~/.bash_history
, then edit the file as you want, and save. This option could be tricky, if you're not used to vi, of course.open -e ~/.bash_history
. This command will open the file with TextEdit, you can choose any other text editor, of course. Modify the file and save.For the changes to be noticeable just restart the bash.