Find the answer to your Linux question:
Results 1 to 5 of 5
Situation: I am logged in remotely to a RedHat server via SSH and I have gone in directly as root. I have entered 30+ commands within the past 10 minutes ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2004
    Posts
    2

    bash history mystery


    Situation:
    I am logged in remotely to a RedHat server via SSH and I have gone in directly as root.
    I have entered 30+ commands within the past 10 minutes at the command line.
    The ouptput of this command "echo $HISTFILE" is /root/.bash_history.
    The last 30+ commands are not in /root/.bash_history.
    The output of this command "fc -l 30" *DOES* show my last 30 commands.


    Where in heck are my most recent commands being stored? Where did "fc -l" find them? Why are they not in my .bash_history file?

    Smiley face to the first person who answers!
    Thanks,
    Tom

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    Commands get written to the bash_history when you type "exit" to logout.

    If you want to get back to one command recently typed without logging out, use the UP arrow key.

    Jason

  3. #3
    Just Joined!
    Join Date
    Aug 2004
    Posts
    2
    I appreciate the reply and, just after I posted this quesiton, I discovered that the history gets written to .bash_history after you exit the shell.

    The question is still open, however: where are those commands before they get written? Where is the command history (via up arrow or "fc -l") coming from?

  4. #4
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    Most likely a list in RAM, the only way to know for sure would be to open up the source code for bash, but im fairly certain its in memory.

    Jason

  5. #5
    Linux Guru kkubasik's Avatar
    Join Date
    Mar 2004
    Location
    Lat: 39:03:51N Lon: 77:14:37W
    Posts
    2,396
    as near as i know it is stored in ram within the program. i dont think it can be activly written to a file.
    Avoid the Gates of Hell. Use Linux
    A Penny for your Thoughts

    Formerly Known as qub333

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •