Using History from Previous Sessions in Terminal

Hello, this may be a very simple thing but it somewhat vexes me. At home I run the Quicksilver, and an Intel Mac at work, from time to time using Terminal.app I run into this issue at work. Opening up Terminal and hitting the up arrow doesn't give me any previous session commands I had entered. But it does at home no problem, is this a simple setting I'm missing between the two computers or does this require something simple in my user file(s)?

Thank you in advance for any help you could provide!

Dual 800MHz Quicksilver 2002, Mac OS X (10.4.10), 1.5GB Ram, 2 250GB Drives, 19" Widescreen LCD

Posted on Oct 22, 2007 2:23 PM

Reply
8 replies

Oct 22, 2007 9:37 PM in response to Bill Scott

And just to widen the scope of responses, here's what the tcsh man page says:

"The history builtin command can print, store in a file, restore and
clear the history list at any time, and the savehist and histfile shell
variables can be can be set to store the history list automatically on
logout and restore it on login."

So, really, the mechanism and degree of difficulty in making it happen are very similar between zsh and tcsh. I would bet that a trip through 'man bash' would reveal something similar.

Oct 23, 2007 6:12 AM in response to I'm a Jack

Hi Jack,

Do you know which shell you are using? If you are using bash, then it's strange that history is not saved; by default bash saves 500 last commands in a file ".bash_history" in your home directory.

What is the output of the following command?

ls -l ~/.bash_history
echo $HISTFILESIZE

If .bash_history does not exists, or if its size is zero, then history is not saved. If the value of HISTFILESIZE is zero then check your .bash_profile (or .bashrc, whichever you are using) and delete the line which sets HISTFILESIZE to zero. Or try setting it to nonzero value such as 500.

Oct 23, 2007 7:39 PM in response to Bill Scott

Interesting. I certainly understood the question to be for #2.
(I'd probably just get very confused if I did #1!)

Now that I think about it, I normally run more than one shell at a time. Each has its own history during any given session. If I'm going to have a shell pick up a previous history when it starts, how is it going to decide which one, or does the history of the last shell I close clobber that of any previously closed shell. Etc.

But this is straying from the original topic.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using History from Previous Sessions in Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.