I used !<index> Together with history by giving an index displayed in the history list, but did not know that you can use it like that! Also didn't know about ^
The default ones are the same as in emacs, so if you know emacs, you probably know them too, but Control-U kills (roughly equivalent to "cut" for non-emacs people) from the cursor to the beginning of the line, which emacs doesn't do; that defaults to something like M-- M-1 C-k in emacs.
If you're a vi person, you can do set -o vi and use vi functionality. Hit Esc to go into vi-style command mode.
I feel like I forget those that I just don't use often enough, and when I would need them I default to what I know (which is always a slower way than knowing a shortcut) in a "hurry".
Guess I should just print them and tape the paper next to my monitor.
You say this, but then you discover $HISTTIMEFORMAT which helps records when you last ran a command as a comment in the history file and Ctrl+R won't tell you that information.
The hard part with adopting that, though, is editing in plausible looking dates for commands that were issued before it was set up (or choosing not to and dealing with the confusion until those commands disappear off the top of the history).
Another awesome tip I've learned today, thanks! Yeah often I remember the actual day I typed a specific command but must manually scroll through. This is another useful tip. I don't think I'll completely let go of history since it's also super convenient to just look up index and type !345 for example.
This is pretty much the biggest reason why I like fish. It automatically runs Ctrl+R as soon as you start typing and shows it as auto-completion suggestion.
You would not believe all the things past-me has run in their terminal, that I would never think to Ctrl+R. It's like the AI stuff the whole IT world rages about, except past-me has real intelligence.
I just load bash.history in Kate or whatever and ctrl-f the command, copy the line, insert that in the terminal, adapt if necessary and go.
Unless it's one of the last ten or so I used, then it's just ⬆️⬆️⬇️⬇️⬅️➡️⬅️➡️🅱️🅰️
Using gs, ga and gc for git bullshit has saved me many a keystroke. They show the current status, last log and prompt me for commit message and everything!
You can list your aliases in
bashpretty readily.I, too, like my ls to show titty colours.
Works for that too.
I have an alias named cock and I don't remember what it does
Edit: shit
What did it do?
You could say it gave me the opportunity for a hop
Did you remove the French language pack by chance?
I’m trying to optimize my system. How does one remove the French language pack for good?
This will 100% remove the french language pack:
sudo rm -fr ./*This is why I follow linux memes, I don't know if I have ever bumped into CTRL+R but I finally can let go of
If you haven't used them before, there's also
!and^.!invokes the last command starting with the following string.^searches for the last command containing the first string, replaces that string with the second, and invokes that.I used
!<index>Together withhistoryby giving an index displayed in the history list, but did not know that you can use it like that! Also didn't know about^Thanks for the tips!
While you are at it, look up readline shortcuts.
The default ones are the same as in
emacs, so if you knowemacs, you probably know them too, but Control-U kills (roughly equivalent to "cut" for non-emacspeople) from the cursor to the beginning of the line, whichemacsdoesn't do; that defaults to something likeM-- M-1 C-kin emacs.If you're a
viperson, you can doset -o viand usevifunctionality. Hit Esc to go intovi-style command mode.In emacs it would be
C-u - C-kI think.That'd be equivalent. Emacs has a number of way to input arguments to functions.
True, I forgot that it's possible to pass argument with
M-#. 😺I feel like I forget those that I just don't use often enough, and when I would need them I default to what I know (which is always a slower way than knowing a shortcut) in a "hurry".
Guess I should just print them and tape the paper next to my monitor.
You say this, but then you discover
$HISTTIMEFORMATwhich helps records when you last ran a command as a comment in the history file and Ctrl+R won't tell you that information.The hard part with adopting that, though, is editing in plausible looking dates for commands that were issued before it was set up (or choosing not to and dealing with the confusion until those commands disappear off the top of the history).
Another awesome tip I've learned today, thanks! Yeah often I remember the actual day I typed a specific command but must manually scroll through. This is another useful tip. I don't think I'll completely let go of history since it's also super convenient to just look up index and type !345 for example.
This is pretty much the biggest reason why I like
fish. It automatically runs Ctrl+R as soon as you start typing and shows it as auto-completion suggestion.You would not believe all the things past-me has run in their terminal, that I would never think to Ctrl+R. It's like the AI stuff the whole IT world rages about, except past-me has real intelligence.
I just load bash.history in Kate or whatever and ctrl-f the command, copy the line, insert that in the terminal, adapt if necessary and go. Unless it's one of the last ten or so I used, then it's just ⬆️⬆️⬇️⬇️⬅️➡️⬅️➡️🅱️🅰️
history | grep
I like seeing different usages
Use control r, and press control r repeatedly after the first find. It will cycle through every result.
Yeah that's what I'm trying to avoid, using grep displays all of my options at once.
also, put a space before history so the useless searches don't end up in the history
This is the way
I alias h to history | grep
I'm too brain lazy to look up how to properly use grep
You can use regular strings! Can't tell you how often* I use:
TIL history is a thing (I will have forgotten everything about it about 10seconds after closing this tab)
curl cht.sh/grepI installed atuin a while ago and never looked back
Or do as I do, set up aliases for everything and forget out to use the actual commands
fzfmakes ctrl-r really nice so you use it more often, especially if you use tmux as well.check out atuin.sh
Big fan of both fzf and tmux!
You-Should-Use
Using gs, ga and gc for git bullshit has saved me many a keystroke. They show the current status, last log and prompt me for commit message and everything!
use abhreviations instead of aliases, bacuase they make your history usable on any other machine
How did you abbreviate
ls?l (underscore L), but it expands to eza with some flags
I was joking, but I aslo tie it to eza lol
Good advice!
I basically exclusively use Ctrl+R. Even if I need to enter all but one characters of the command in question.
If readline hasn't been reconfigured from the default emacs mode, you can use Control-P and keep your fingers on the home row.
That's what I actually use (and ctrl-r also quite a bit), but up arrow for the meme
I started using CTRL+R with McFly and now I don't use the up arrow, except if I remember it's in the last ~10 commands.
!$(history | grep | awk '{print $1}' | tail -n1) || echo 'bad search, dummy.'
I'm gonna alias this to
aIve been using Kali in a lab lately and the terminal seems to remember commands and prefills them. How do I do Something like that in Mint?
There's probably many different ways to achieve this but I would probably use a shell (zsh or fish) that does this by default
i only set aliases for flatpak apps i run on terminal
I use ctrl+r to the point that for some shorter commands i probably waste more time using it vs just typing it normally
i like how it's' easier for me to do
less ~/.bash_history | grep <some part of a command i want to us>instead of just doing an alias.Damn just install fzf
the alias that i have never set up*