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
Combine ctrl+R with fzf and get the best of both worlds
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.You can press up
seeing multiple at the same time is more helpful though
https://atuin.sh/
Ppsshh. Not lazy enough. Create that in a script and call it “hgrep” and drop it into path.
Brilliant
Why not just use an alias?
That’s the right way, yes.
i was doing
cat ~/.bash_history | grep thing
which is stupid so i started doinggrep "thing" ~/.bash_history
now you’re telling me i should do
history | grep thing
i 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
Exactly! Now copy paste it into Joplin where you’ll never see it ever again.