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 run Efgh
.
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
Here is an alternative Piped link(s):
https://www.piped.video/watch?v=sXx7b0uCWkk
Piped is a privacy-respecting open-source alternative frontend to YouTube.
I'm open-source; check me out at GitHub.
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?
Get your Apple product placement out of here!
Talk to your cat about set +o history
before they end up leaking credentials
Can 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 do set -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 arrow
Real OGs put a space right after the prompt.
Ctrl-R
Not enough bashing.
Scammers trying to make a virus to infect Linux users
linuxmemes
Hint: :q!
Sister communities:
- LemmyMemes: Memes
- LemmyShitpost: Anything and everything goes.
- RISA: Star Trek memes and shitposts
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack members of the community for any reason.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
- These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudo
in Windows. - No porn. Even if you watch it on a Linux machine.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
Please report posts and comments that break these rules!