Ctrl+r was a life-changer when I first learned it.
I think it’s the only shell shortcut I know haha
You can install fzf to make it fancier.
Same. For anyone using fish shell, this plugin is super-handy: https://github.com/PatrickF1/fzf.fish
Yep, I don’t like these “recommended” methods, too. Fortunately, you can just use your favourite package manager instead: https://docs.atuin.sh/guide/installation/#manual-installation
If you have fzf
installed, it is easy to integrate it with your bash history.
In my .bashrc
, I have:
# Introduce fzf-driven functionality as described here: https://wiki.archlinux.org/title/fzf.
source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash
Also, you may be interested in zoxide
, which keeps track of paths you have navigated to.
Also from my .bashrc
:
# Enable an autojump-like 'j' command. Use 'ji M' to select paths starting with M using fzf.
# This needs to always come last.
eval "$(zoxide init --cmd j bash)"
Here’s something I use to search history for commands or keywords. I have this as a function in my profile:
function hgr() {
history | grep "$1"
}
h
istory gr
ep
Usage: hgr git
to search for commands containing git
.
Someone more knowledgeable may be able to point out ways to improve this.
you can get a lot of the way there with Control+R reverse history search (mentioned in the article) – and it’s interactive. With fzf
you can even get fuzzy history searching (the first search result has a video). atuin
puts history into a proper db, optional syncs across hosts, and, like fzf, enhances control+r
New to Linux as my daily driver. This is life changing. I was up/down arrowing like a madman!