-   Linux - Software (
-   -   bash history (

jasonnth 08-06-2006 11:09 PM

bash history
if i login as root and run bash when i am root
where does command history log goes to after running bash?
i checked the .sh_history_root and my home directory and its not there

gilead 08-06-2006 11:19 PM

If you login as root, the file should be /root/.bash_history

jasonnth 08-07-2006 04:07 AM

well, i saw the file .bash_history buts its empty
anywhere else the history log could go?

b0uncer 08-07-2006 04:13 AM

Usually it's under the user's home dir, so if /root is not the home directory, then try


cat $HOME/.bash_history
If it's not that, you've got to hunt someplace else.

jasonnth 08-07-2006 05:42 AM

odd, i use find command to search all the .bash_history
all of them listed are 0 bytes
could it be disabled by the system?

if so, anyone knows where the switch is?


timmeke 08-07-2006 05:53 AM

Post your environment variables (the output of 'env' should do).
Especially look for variables whose name starts with HIST (ie grep for HIST), such as HISTSIZE & HISTFILE.
$HISTFILE can be used to set a specific location for the history file (instead of using the default).
$HISTSIZE, if set to 0, will probably disable the command history.

See also the man page of your shell.

jasonnth 08-07-2006 11:26 PM



timmeke 08-08-2006 02:35 AM

As $HISTFILE indicates, the file you're looking for is /root/.sh_history_jasonnth.
It should contain (at most) 2000 commands.

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