Pages

Sunday, January 4, 2015

Not saving commands to history in Linux




Not saving commands to history in Linux
--------------------------------------


 echo $HISTCONTROL

if "ignorespace" not found then execute a command

export HISTCONTROL=ignorespace

------------
 Now give the command with a spcae

root# ls    not  root#ls
root# cat /etc/hosts

now With  a spcae command will not save in history file
and enjoy this............@tayab-Khan


-----------------------------
============================== altername methods

unset HISTFILE
disable history for current shell session
this will cause any commands that you have executed in the current shell session to not be written in your bash_history file upon logout


ssh user@hostname.domain "> ~/.bash_history"
Don't save commands in bash history (only for current session)


HISTFILE=
disable history for current shell session

No comments:

Post a Comment