This question already has an answer here:

I'd like to clear recent inputs in terminal not cls or clear but when you press up or down. How do I clear this list so that when I rename sudo to nodood or something you cannot press up to view the new sudo perhaps my script will read input.

EDIT: Note pressing Ctrl + R in terminal will let you search history like history | grep searchQueryString Another useful tip is sudo !! which re-executes last command with sudo prefixed

marked as duplicate by muru bash Oct 18 at 15:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    For complaints about the system use the meta site. For askubuntu that would be meta.askubuntu.com And it is of course an anti-spam measure. Please ONE question per topic. I answered the history part. The other one needs a separate question. – Rinzwind Oct 18 at 13:50
  • It is me that removed the rant in the question. – Rinzwind Oct 18 at 15:04
  • so after viewing the other post the history -c worked and about the mass renaming using mv . .*+datehashsuffix I will post a new question after having waited hours. And since I am not "well received" – Punkroku Oct 19 at 5:26

To clear your history use

history -c
  • +1 my friend! Also, if you don't want history -c in your history put a space in front of the command. =) – Terrance Oct 18 at 14:11
  • history -c will delete history of the present session of the terminal. For complete delete rm ~/.bash_history – Hobbyist Oct 18 at 16:01
  • He said 'recent' ;) – Rinzwind Oct 18 at 16:08

Deleting history

  • If you want only to delete a single command (eg: you have erroneous typed your password) type

    history -d <line number>
    
  • In case you want to delete the entire history enter

    history -c; history -w
    
  • History files can be found in your home directory. For bash this will be .bash_history and the temp files .bash_history-xxxxxx.tmp. Hence deleting these files would be another option.

To find out more about history's hidden features take a look at the gnome bash manual.

Not the answer you're looking for? Browse other questions tagged or ask your own question.