Imported from the Apple Support Forums via the Wayback Machine 🔗
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!
Imported from the Apple Support Forums via the Wayback Machine 🔗
This is shell-specific.
In zsh, you just need to have issued
setopt share_history
somewhere in your startup files.
Just another reason to use zsh.
0
etresoft·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Bill Scott wrote:
Just another reason to use zsh.
Really? I don't have to do anything for bash.
0
Bill Scott·
Imported from the Apple Support Forums via the Wayback Machine 🔗
My bash (that which came with 10.4.10) doesn't share history by default between independent login shells.
0
Don MacQueen1·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
0
Bill Scott·
Imported from the Apple Support Forums via the Wayback Machine 🔗
OK, maybe we are talking about two things here:
1. The ability to share history between two terminal sessions in parallel
2. The ability to pick up where you dropped off when you close a terminal session and then start a new one, i.e., in series.
zsh, bash and tcsh all do #2. I've only figured out how to get zsh to do #1 (the above-quoted command).
0
Jun T.·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.
0
I'm a Jack·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Thank you all, I have switched to bash just to make it simple, other options I will look into as well.
Thank you all again for your help in this matter, this will make my daily terminal tasks a tad speedier!
0
Don MacQueen1·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.