LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to delete bash terminal history upto certain no. of commands (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-delete-bash-terminal-history-upto-certain-no-of-commands-781763/)

sd|| 01-12-2010 01:50 PM

How to delete bash terminal history upto certain no. of commands
 
i want to delete some say 10 previous commands in bash shell!! what shud i do??

MensaWater 01-12-2010 01:55 PM

Why would you be wanting to cover your tracks like that? :tisk:

bobshaffer2 01-12-2010 01:57 PM

Try editing ~/.bash_history. If that doesn't work, IDK. I think there is a way to get bash to not add it to history at all, but I don't recall exactly how it's done. I stumbled upon it once by accident...

arizonagroovejet 01-12-2010 02:13 PM

Quote:

Originally Posted by sd|| (Post 3824089)
i want to delete some say 10 previous commands in bash shell!! what shud i do??

'should'.


Bash history is usually stored in ~/.bash_history but it's location can be controlled by setting $HISTFILE
The history file is only written when the shell exits, so you can delete the last ten lines from a history file but that might not be what you want.
You can prevent anything from being written to the history file by setting the value of $HISTSIZE to 0. Or I guess you could set $HISTFILE to /dev/null.

See also http://www.faqs.org/docs/bashman/bashref_106.html


All times are GMT -5. The time now is 03:48 PM.