image of a cat looking at a bunch of paper a woman shows it, with the header “cat ~/.bash_history”
A colleague mocked me the other day because I didn’t know about the “history” command and I was using “cat .bash_history”
So, yk how the history command outputs something like this:
1 Abcd 2 Efgh 3 Ijkl
If you run
!2
, you will runEfgh
.It blew my mind the first time I saw it, but maybe I’m just stupid.
I actually use quite frequently "sudo !!“, but I didn’t know the details of why it worked…
Now I see more sense in using the history command, specially combined with grep.
Same here, I just assumed it was a special thing that saved the last command. Had no idea it was actually a query to the history
TIL
Learn some more: https://www.youtube.com/watch?v=sXx7b0uCWkk
the what command?
they mean arrow up, right?
laughs in fish shell
laughs harder in nushell
Laughs hardest in nutshell
cries in kornshell
Ponies in Ponyshell?
deleted by creator
Get your Apple product placement out of here!
Talk to your cat about
set +o history
before they end up leaking credentialsCan also recommend
HISTFILE=""
, which amounts to the same thing.Not quite. Unsetting
HISTFILE
, or setting it to an invalid path will mean the shell doesn’t update the history file while it quits.set +o history
makes the shell stop recording until you doset -o history
, which is useful if you want shell history generally, but don’t want some specific commands to be recorded - if you just unset HISTFILE, the commands still show up if you press the up arrowReal OGs put a space right after the prompt.
Ctrl-R
deleted by creator
Scammers trying to make a virus to infect Linux users
Not enough bashing.