Terminal problem

Discussion in 'Mac Apps and Mac App Store' started by marsbar, Sep 25, 2009.

  1. marsbar macrumors newbie

    Aug 20, 2008
    Each time i restart my terminal I lose the previous command history. This is quite annoying.

    Anyone know the solution to this problem?

  2. pilotError macrumors 68020


    Apr 12, 2006
    Long Island
    What do you mean? When you type the history command it doesn't display anything? Or are you trying to recall commands.
  3. marsbar thread starter macrumors newbie

    Aug 20, 2008
    I can't recall commands. When I press "up" nothing happens...
  4. maflynn Moderator


    Staff Member

    May 3, 2009
    If closed the terminal session, I don't expect it to retain the history. Is the window closed but the program still running or do you exit completely out of the terminal?
  5. marsbar thread starter macrumors newbie

    Aug 20, 2008
    Normally the terminal history will be available even when you've quit and re-opened it. I've tried this before, it worked great (and used it alot) in Leopard, and friends at my university have it working like that in Snow Leopard as well. I thought it was default, and I have looked at the Terminal prefs a thousand times, but I just can't figure it out:confused:
  6. eatbacon macrumors regular

    Feb 4, 2003
    This is not a function of the terminal app. It is a function of your shell. If, for instance, you are using bash (the default) then your command history is stored in your home directory in a file called .bash_history

    I would start by checking that that file exists and has read and write permissions for your user.
  7. Darth.Titan macrumors 68030


    Oct 31, 2007
    Austin, TX
    You're correct, it should retain your command history. They're stored in your home folder in a file called .bash_history

    Maybe the permissions for this file are messed up? Have you tried repairing permissions?

    Just throwing out some ideas.
  8. rowsdower macrumors 6502

    Jun 2, 2009
    You might need to hit Ctrl-D (or type logout) to close bash and write the history file. I thought it wrote the history as you typed the commands though.
  9. bankshot macrumors 65816


    Jan 23, 2003
    Southern California
    On OS X, bash defaults to automatically save 500 lines of history, so I suspect you're using a different shell. The default settings for tcsh, for example, don't save any command history. If this is your shell, you would add something like this to your .tcshrc file (or .cshrc if .cshrc already exists):

    set history=500
    set savehist=500
  10. marsbar thread starter macrumors newbie

    Aug 20, 2008
    I am using bash...

    However, I've been setting up SVN and have been creating and editing a file (.bash_profile). In the file I only inserted this line:

    export PATH=/opt/subversion/bin/:$PATH

    I was following the tutorial at THIS website.

    I checked to see if there was a .bash_history file, and there was. It holds nothing, however.

    I am really puzzled, and tempted to format and reinstall Snow Leopard:(
  11. rowsdower macrumors 6502

    Jun 2, 2009
    Maybe remove the existing .bash_history file and see if it gets recreated...
  12. marsbar thread starter macrumors newbie

    Aug 20, 2008
    I tried that and it worked!!! Thanks a lot :)

    Don't know what happened.

Share This Page