- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
I’ve been using
ctrl + R
more now :3… though I definitely used to ↑↑↑↑↑↑↑check out fzf (install fzf and add (assuming bash)
eval "$(fzf --bash)"
to your .bashrc) Makes ctrl+r a superpowerIt’s awesome until you want to put the cursor in a specific spot of a previous command.
$ rm -f delete-me.txt ctrl-r "me", ctrl-b, ctrl-k $ rm -f delete
But I still use fzf because while I used to do the above, fzf offered more advantage that made switching worth it.
I’ll try it if I don’t forget it by the next time I have access to my PC lol :3
Ctrl + r with fzf and you’ll never go back.
Woah Ctrl R looks super cool, never knew that I could do that before…
Ctrl R
holy fucking shit 🤌💪🤯❤️💯
…until you press up one too many times and enter the same command but with a typo. Again.
Been there, done that.
The number of people who don’t reverse-I-search is too damn high
CTRL+R for those unitiated
reverse-i-search + fzf = <3
It was quite a while before I realised that was possible.
Then not long after starting to use it, that I got fed up and just started opening up the history file and searching in it.why not
history | grep -i
and the search term?even if there are several, you can use ! and the command’s line number to run it again
history
is shell dependent.
^r
and whenever you forget to sudo:
sudo !!
You need this: https://github.com/nvbn/thefuck
Ctrl-r, l ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r. To get ls.
No way! I didn’t know you could cycle through the results like that… awesome!
It’s basically emacs incremental search.
I typed it once, I’m not typing it again
I write part of the command then ctrl+r. Using FZF mind you. Such a great utility.
taptaptaptap… taptaptaptap… taptaptaptap taptaptaptap taptaptaptap
… taptaptaptap
… tap …
… shit I was on a different user when I typed it.
Or “shit, I did in tmux last time so I could close the terminal window.”
Relevant xkcd: https://xkcd.com/1168/
tar --help
tar -xvf <archive-name>
but only because I had to look it up twice so now my brain has committed it to memory
I don’t even know what it doesExtract a tarball with verbose output from the specified file.
And learn how to use the ‘z’ option
You don’t even need the hyphen!
Mind = blown.
tar -jcvf archive.tbz ~/stuff/*
Of course I don’t know the bomb had bzip2 on it… I wonder if we can start with ls to see if there’s anything to tar or untar
tar - h
Unfortunately that’s not valid.
$ tar -h tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information.
From man-page:
-h, --dereference follow symlinks; archive and dump the files they point to
Damn.
Thanks, we all died.
:)
O(n) access, very efficient.
No, I do not care to share the value of n
cat ~/.bash_history | grep
Useless use of cat?
Yes, it was meant to be a self deprecating admission that I have used this unnecessarily verbose command.
Ah. Well. I can not be blameless on this. I also probably use cat unnecessarily still. But less so with grep these days. I’m getting better… I swear!
https://github.com/atuinsh/atuin is a great tool to manage and search your shell history. I especially enjoy it being able to search commands based on the working directory I was in when I ran them.
It also has more features (which I don’t use) to manage dotfiles and sync shell history across hosts/devices.
I was going to talk about it too ! Even though I’m on fish (which helps a lot with history search) atuin really changed my habits and made my life easier !
Substring completion on ZSH. Type in a small part of the command you want to find and then press up.
bash supports this feature too btw
Added to my mental toolbox, thanks!
history | grep 'gre[p]' | less -S
Does fuck all when you can’t remember even a piece of the command lol
That’s when you start spamming Page Up/Down, Home, End, and
/
to search withinless
. Usually seeing various commands jogs my memory, especially when they aregrep
commands searching for one I use often enough to be useful but infrequently enough to not remember off the top of my head.Then how well you know which command it is when scrolling. At that point it’s googleing how do I move a file or whatever your looking for.
This is the answer
Wow this is really validating for me to read. I’ve been using Linux for a few years but I’m definitely not a computer expert and am intimidated by the command line.
I’ve always felt like googling every command and arrowing up to find an old entry rather than just googling it again marked me as a fake Linux user, not a real one.
Lol don’t feel bad, I can do advanced crazy shit with Linux like pivoting the running OS into RAM so I can unmount the boot drive to do whatever without ever rebooting
But I still [Web Search] commands a shit ton of the time LMAO
You can use Ctrl-R and Ctrl-Shift-R to search through your history instead of having to push up a bajillion times.
Nah, fuck the gatekeepers, you’re all good.
I think that actually makes you a real Linux user…