You are not logged in.
I noticed this problem yesterday: terminal only remembers commands I entered three days ago, starting today, last of them being the pacman -Syu I performed on tuesday. From that point onward, it "forgets" all commands every time I close it
Last edited by Daerun (2011-03-11 23:22:04)
Offline
Which shell are you using? If bash, do you have write permission to ~/.bash_history?
A temporary file is just a pipe with an attitude and a will to live.
Offline
Known upstream issue. Exit your terminal using "exit" or "ctrl+d" rather than closing the window.
Offline
Known upstream issue. Exit your terminal using "exit" or "ctrl+d" rather than closing the window.
Really? lol But How is it that older commands are there? I've always closed it via mouse...
Offline
It started with bash-4.2
Offline
Add to your .bashrc
export PROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND"
It will mix history between open terminal windows, but it will also remember history
Proud ex-maintainer of firefox-pgo
Offline
Add to your .bashrc
export PROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND"
It will mix history between open terminal windows, but it will also remember history
Hooray! As a habitual button clicker, it was driving me mad trying to remember to exit every time. Thanks for this useful tip!
Offline
Yup, that works, thanks
Last edited by Daerun (2011-03-11 23:21:08)
Offline
@blasse your amazing, thanks for the tip.
Offline
The 'history' command accepts concatenated parameters, so instead of 'history -a; history -n', you can just use 'history -an'. Also, the preceding 'export' is redundant in this occasion.
Btw, I myself always use 'history -a' as 'PROMPT_COMMAND', which makes new terminals opened inherit the history of the current terminals running, but I do not like the 'history -n' option, which will make all open terminals continously inherit each others history.
It's a matter of personal preference obviously, but check out the following example:
When for example you open a terminal just to start some server. Then you open another terminal and play around for a while. Then you want to restart the server process, so you go back to that terminal and Ctrl+C it and hit UP to go back in your history to re-run the server command. But oops, now a lot of commands are in between you and the one you want...
The 'history -a' command will overcome the above problem, but if you don't care about isolating each terminals own history from the others, then 'history -an' makes better sence... (imho, of course...)
Both ways will obviously also fix this bash issue, as it's the 'history -a' option which fixes it i.e. writes the history to file upon each return/enter press...
Offline
$ history -an
bash: history: cannot use more than one of -anrw
Offline
@zippy + all
I apologise for posting wrong information, and thanks for the correction!
I had read on another forum someone stating that you could just use 'history -an' instead of 'history -a; history -n', and I just remembered that, when I saw this thread. I always myself just prefer to use 'history -a', so I haden't tested the 'history -an' command personally and just took the tip of that other forum to be true...
Again, sorry about that!
Edit: I got it from here: http://briancarper.net/blog/248/
Quoth Amos on June 11, 2010 @ 4:04 PM PDT
Thanks for the tip.A couple of small corrections
1.It's not necessary to "export" PROMPT_COMMAND (i.e. it doesn't need to be set as an environment variable). It's enough to do "PROMPT_COMMAND='history -n'".
2.If you want to keep running both then you can just set PROMPT_COMMAND to "history -an". Although after reading the comments here I agree that the -n is going to be annoying.
Last edited by mhertz (2011-03-16 12:03:06)
Offline