For me ctrl-r is faster most of the time, history | grep [command] is better if I can’t easily pattern match (don’t remember it exactly, using several flag variations, etc.). they’re both good tools.
In short, unless you want the contents of a file printed to stdout (or multiple files concatenated), the command can probably be written without cat, instead using the filename as an argument (grep pattern file) or IO redirection (cmd < file).
Stylistics and readability are another thing though.
history | grep [the thing]
CTRL+R [the thing]
please i beg you
with grep I see all the alternatives, Ctl+R just shows me one
For me
ctrl-ris faster most of the time,history | grep [command]is better if I can’t easily pattern match (don’t remember it exactly, using several flag variations, etc.). they’re both good tools.Combine ctrl+R with fzf and get the best of both worlds
You can press up
seeing multiple at the same time is more helpful though
https://atuin.sh/
i was doing
cat ~/.bash_history | grep thingwhich is stupid so i started doinggrep "thing" ~/.bash_historynow you’re telling me i should do
history | grep thingi can’t win
Some would call the former command cat abuse.
In short, unless you want the contents of a file printed to stdout (or multiple files concatenated), the command can probably be written without
cat, instead using the filename as an argument (grep pattern file) or IO redirection (cmd < file).Stylistics and readability are another thing though.
it 100% is, its just a bad habit of mine
Ppsshh. Not lazy enough. Create that in a script and call it “hgrep” and drop it into path.
Why not just use an alias?
That’s the right way, yes.
Brilliant
Exactly! Now copy paste it into Joplin where you’ll never see it ever again.