- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
The one people see me doing that gets a “huh?” Is:
~$ !find find -type f -name '*blah*' -print0 | xargs -0 gzip ~$“Wait! What did you do?” “Oh. Do you not know about bang?”
I don’t understand people who have the confidence to just blindly run the last matching command like that. Like, are you 100% sure that the last time you ran find was that one, not the one that piped to
xargs rm?At least with zsh you can tab to complete the
!findand verify it’s what you want before running it. And, AFAIK by default, the shell optionhist_verifyis set, so if you do just type!findand hit enter, it doesn’t run the command, it loads the command into the editing buffer so you can look it over first. Maybe I just have a weak memory, but I really appreciate the footgun prevention. At worst I have to hit enter twice. At best, I save myself a lot of grief.I love the excitement of using !?
Did I remember correctly what command sequence I last used that pattern with? Will my data be gone? Will I send a vulgar email to my boss? Who knows, let’s find out!
I’ve been using
ctrl + Rmore now :3… though I definitely used to ↑↑↑↑↑↑↑Woah Ctrl R looks super cool, never knew that I could do that before…
check out fzf (install fzf and add (assuming bash)
eval "$(fzf --bash)"to your .bashrc) Makes ctrl+r a superpowerI’ll try it if I don’t forget it by the next time I have access to my PC lol :3
It’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 deleteBut I still use fzf because while I used to do the above, fzf offered more advantage that made switching worth it.
Ctrl + r with fzf and you’ll never go back.
Featherpad, copy, paste. Extra work, but you get a work log
…Yeah, you got me.
I wish this wasn’t so painfully true.
Too many people still use Bash.
I like zsh on mac because pretty colors
Too many distributions still ship with Bash.
In the real world, the only thing better than perfect is standardized.
Yeah, true. But, it’s easy to change.
Bash is the Internet Explorer of shells. It’s great for installing a more useful shell.
That’s super unkind and incorrect. IE was a trash software that was widely available because MS was trying to extend their monopoly into new areas.
Even if it’s not your taste, bash is a mature, stable FLOSS package with wide community support. The reason it is so common is due to it’s positive attributes, not because there is a plot to make it the only choice available to you.
Bash might be better than IE. But I think we can agree that it is no longer a good shell.
Its syntax is awful, and lacks many features that other shells have.
It is only so widely used because it is a de facto standard. If bash was created today, barely no one would us it.
That’s not true. Internet Explorer was fucking useless for scripting together things, unlike bash.
Internet Explorer shell expansion always trips me up.
What shell do you recommend?
I like zsh, but some people say great things about fish.
My problem with those is bash is always there and just works.
Yes, just like Internet Explorer.
It’s good to know how to do things in bash, since you’re going to encounter it pretty often. But, that doesn’t mean you shouldn’t customize your shell on the machine(s) you use most often. Why stick with the default when there are better options? You’re just hobbling yourself.
history | grep 'gre[p]' | less -SDoes fuck all when you can’t remember even a piece of the command lol
This is why I like atuin, I can just press up and start typing part of the command and it will likely find it in my history.
You could already do that with just “Ctrl-R” but without atuin redrawing your screen.
history | grep then !cmd no
The number of people who don’t reverse-I-search is too damn high
reverse-i-search + fzf = <3
CTRL+R for those unitiated
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 -iand the search term?even if there are several, you can use ! and the command’s line number to run it again
historyis shell dependent.
I knew there was an
lsIn there somewhere
Now I don’t have to type that in again. Phew!
ctrl + r, l, s
Much faster than simply typing
ls!ls … enter ↑ enter ↑ enter
You may consider using
watch ls
Or, just type the command “history”, find the index number of the desired command, then type “! <index number>”, then <enter>.
Ctrl-R if you know part of the command.
That’s way more mental effort than pressing up a bunch of times.
Holy cow!! I didn’t know that. I have been using history > history.txt to find “that one command for that one thing” I only need once every other month or so. Thanks, now I can just do that.
or Ctrl+R then search? I don’t know why people bother with
historytbh.This is going to save me so much time pressing the up arrow.
Because you can pipe history to grep.
with fzf you get better grep with fuzzy search
also when they see this post
deleted by creator
I always go past it because I go way to fast.
I have more then once gave up on pressing up, hit ctrl + c to reset only to see the command I wanted briefly flash up as I am hitting ctrl + c















