Up arrow history seems to expire in Bash shell terminal

terminal

#1

I noticed that hitting up arrow does not toggle through historical commands after a certain period of time (more than a few minutes but less than 24 hours). Is this by design, a known issue or is this the first anyone has noticed?


#2

I would guess it’s because it’s not saved to disk like it normally is on a normal distro so when the workspace shuts down after a few hours of idling, it goes away.


#3

please fix this behavior which is bad and is not normal.


#4

Unfortunately, this is an important part of the design of Cloud9 and is one of the reasons you can have free workspaces. If they kept file logs, it would count towards your disk quota. If this is really important to you, you can upgrade to a premium account, which gives you a limited number of “hot workspaces” that stay active.


#5

you can modify your .bashrc, to save history after each command

HISTSIZE=1000
HISTFILESIZE=2000
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

#6

sheesh - a history file is what, at most 30K? yeah, that will kill the free accounts. not.

haven’t looked into it, but i’ll bet there is something i could run with cron to output the history occasionally into a managed file, de-duping as it goes.


#7

sweetness! that is just what i was looking for and will give it a shot. THANKS!


#8

not exactly sure how to test it - or how to simulate the event that juts stops the instance dead.

is that a ‘Restart Workspace’ or a ‘Quit Cloud9’ ?


#9

it is restart workspace, but the above command saves all history, so opening new terminal should be enough as a test