I am trying to erase history list in my linux box, but my below command is failing. What is the actual way to clear it?
> history clear
-bash: history: clear: numeric argument required
Also when I run my commands in my command prompt, my team lead can see my command list as he has the root access. Any alternate way to issue commands so that nobody can get my commands?
I also had a same problem long time back. I was using UNIX-HP and I found that all entries are stored in .sh_history(hidden file) in my home directory. So, I just made it empty and I was done. U can also try this.
I am using bash shell and my historyfile is set to .bash_history. but surprisingly when I am trying to view this file, it's empty. but again history 10 command is giving me some output. How it's possible? That means history data is not getting written into .bash_history. What you think ?
history 10
24 history -10
25 history -l
26 history 1
27 history 10
28 history 100
29 cat /home/naresh/.bash_history
30 ls -l /naresh/.bash_history
31 echo $HISTFILE
32 echo $SHELL
33 history 10
Bash keeps it's history internally until it exits. This is why your .bash_history can be empty while you see old commands. This is also the reason why, when closing multiple instances of bash (eg. terminal sessions), only the commands from the last closed session can be found again.
To completely clear, you'll have to remove .bash_history without running bash.