How To Clear Shell History On Centos / RedHat

by lifeLinux on August 22, 2011

To clear shell history, type the following command:

$ history -c

Or remove .bash_history file

$ rm -rf ~/.bash_history

Turn off shell history

To turn off shell history for all users, type the following command as root

# echo "unset HISTFILE" >> /etc/profile

To turn off shell history for a specific user, type the following command

$ echo "unset HISTFILE" >> /home/USER/.bash_profile

Display shell history

To display shell history, type the following command

$ history | more

Sample outputs

74  exit
75  cd /etc/samba/
76  ll
77  vi smb.conf
78  exit
79  cd /home/site.com/scripts/
80  dir
81  cd cassandra/
82  dir
83  cd conf/
84  duir
...

Related Posts:

{ 1 comment… read it below or add one }

hot business May 5, 2013 at 7:30 am

it is great. i came to learn something here.

Reply

Previous post:

Next post: