Comment by scrapheap
4 years ago
No maintained cheat sheet here either. I do use `history | grep` quite a lot though.
One thing I try to do is to keep my keyboard shortcuts consistent between programs/systems. That way the chance of my instinct of pressing `<CTRL>+a` to move the cursor to the start of the line will be correct more often.
Another thing I try to do when a project has a set of complex commands that are needed, is to add them as a rule in its Makefile, that way they're available for my colleagues as well.
I use zsh-histdb[1], which records my entire shell history for all time in a database, which also stores:
This the working directory of the command has been especially useful for me to get the context of what I did, not only the command itself.
[1] - https://github.com/larkery/zsh-histdb
I use Ctrl+R chronically for the same thing.
I've been loving mcfly[0], a history search that can be bound to <ctrl+r>. It makes suggestions based on your current directory as well as your command history.
[0] https://github.com/cantino/mcfly
and when history grepping starts to repeat - memorize it
same here - my cheatsheet is `history | grep`
I'm curious why history | grep and not ctrl-R?
Probably because ctrl-R doesn't present you a list in most shells. Maybe you want to scan the list visually and look at neighboring commands. ctrl-R doesn't really take advantage of human vision by showing all results next to each other.
3 replies →
Regular expressions. Sometimes you remember two non-adjacent parts. Ctrl-R doesn't let you find "when I used find with awk" unless you type in everything in between.
Ignorance is bliss! Didn't know what ctrl-R does