Better Bash History (2012)
sanctum.geek.nz
Better Bash History (2012)
1–10 of 85 posts
Re: Better Bash History (2012)
#2Re: Better Bash History (2012)
#3I find this super-helpful to remind me of the context for projects – cd in, then up-arrow to whatever that command is I usually run to launch this server, grep this logfile, etc.
There are some downsides – sometimes I want to run the same command in directory X and also in subdirectory X/Y, but I love doing it this way.
Anyone else done something similar?
Re: Better Bash History (2012)
#4highly recommended for fellow ctrl-r addicts: https://github.com/junegunn/fzf
Re: Better Bash History (2012)
#5Re: Better Bash History (2012)
#6I set up my bash config to store history separately for each working directory (ie separate history files that I store under a $HOME/.bash_history_d directory) – so as I cd into a project directory, the history is populated with the commands that I've run within that directory . I find this super-helpful to remind me of the context for projects – cd in, then up-arrow to whatever that command is I usually run to launc…
Re: Better Bash History (2012)
#7I kept loosing my history consistently on my new installation because of this. I usually put my laptop to sleep, and pretty much never intentionally terminate my x-session except on kernel updates. But because its a cheapo laptop with a crappy battery, I would occasionally run out of battery when asleep or it just wont wake up.
Re: Better Bash History (2012)
#8Re: Better Bash History (2012)
#9Every combination of history commands in bash didn't do the right thing[1], but Zsh's works as desired.
[1] eg. putting 'history -a' in PROMPT_COMMAND as the article recommends appends your session's entire history each time, IIRC.
Re: Better Bash History (2012)
#10Bash's broken history is what finally got me to switch to Zsh. The history behavior you want is: 1. each line of history is appended incrementally, but 2. each shell session only has access to its own history unless you specifically reload the history into your session. Every combination of history commands in bash didn't do the right thing[1], but Zsh's works as desired. [1] eg. putting 'history -a' in PROMPT_COMMAN…