[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On 30/01/14 16:40, Kevin Lucas wrote: > History is great for this > > I have in .bashrc > alias h='history' > > so when I get stuck just type h | grep "the ball park command" > then to run just type !(the command no) and it all comes flooding > back.... > > ie I can never remember the commands for rsync > > so h | grep rsync > > 361 sudo rsync -avz /var/www/ kevinspc:/var/www/html > > so running !361 > > will back up my web server.. > This is *such* good advice: my .bash_history files are a treasure trove of voodoo and half remembered commands. I have similarly: alias hgrep="history | grep -i " Because I can't be bothered typing "| grep -i" every time. Don't forget to set HISTSIZE and HISTFILESIZE to more sensible values - I use 10k and 20k respectively and on this box "wc -l .bash_history" yields 6787 today - not counting the several other files that have already hit 10k and been rotated out, but kept for prosperity. Without shell history at least 50% of my productivity would go straight out of the window... CTRL+R searches backwards through your history as you type partial commands and brings them up on the command line for autocompletion - without this feature, the other 50% of my productivity would go out the window as well. It still staggers me that without 3rd party tools/shells, to this day Windows will *still* wipe your command history every time you exit a shell, even the powershell where verbosity is king and single one-shot commands can be multiple lines worth of typing... stick with Cygwin bash when you have to deal with them. What I would really like, probably more than any other single tool, is a network based, centralised DB repository for ALL of my shell histories, suitably tagged with metadata and immediately searchable from any network connected machine over SSH. I want to be able to type "nethist -l ghost -s openbsd pf" on my Linux box and get all of the instances from any OpenBSD machine I logged into as "ghost" and typed the pf command. Similarly I'd want to be able to specify username, machine, groups, operating system, date ranges and other useful parameters and effectively grep through 15 odd years worth of every command I've ever typed on the hundreds of computers and multiple operating systems I've used. This would be the best tool ever. I've had several goes at knocking it up myself, via shell scripts, SSH tunnels and a SQL DB at the backend but it's always been ugly, slow and quite frankly, badly done. An actual programmer would do a much better job of course, and I dearly wish someone would. Why doesn't such a thing exist? Regards -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/listfaq