Fish once again undefeated. If I want to find that weird image magick command I used earlier with foo.png in it I just type foo.png
, hit up and its usually the first one. It doesnt matter where foo.png occurs in the command, fish will find it.
Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
I typed it once, I'm not typing it again
Ctrl R
holy fucking shit 🤌💪🤯❤️💯
I've been using ctrl + R
more 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 superpower
Ctrl + r with fzf and you’ll never go back.
The number of people who don’t reverse-I-search is too damn high
...until you press up one too many times and enter the same command but with a typo. Again.
Been there, done that.
There is an option you can set in .zshrc or .bashrc which only includes lines that exit 0 (success)
Infuriatingly that would omit things like unit test runners from the history in case they don't pass. As a developer I tend to re-run failed commands quite often, not sure how widely that applies, though.
^r
Ctrl-r, l ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r. To get ls.
- zsh-autosuggestions
history | fzf
alias cat="bat --plain --theme=gruvbox-dark"
Aliasing cat
or any other ubiquitous shell utility to a replacement is a mistake. Garuda did this, and it was driving me crazy why cat
was giving me errors. Turns out that they had aliased bat
to cat
, and since bat
is a different program, it didn't work in exactly the same way, and an update had introduced some unexpected behavior.
Drop-in replacements are dumb. Just learn to use a different command.
I think it's ok to add this in a personal .zshrc
, not on a distro level:
If it breaks something - I'd probably know why and can easily fix it by removing alias/calling cat directly.
Also, scripts almost always use bash or sh in shebang, not zsh. So it only triggers if I type cat
in terminal.
It's better to learn the new command, then it still works when you use a different machine that doesn't have your alias
Also, even zsh scripts don't read your .zshrc by default.
You have to be a linux user to use the console now?
I’ve probably done that for ls
taptaptaptap.... taptaptaptap.... taptaptaptap taptaptaptap taptaptaptap
.... taptaptaptap
... tap ...
... shit I was on a different user when I typed it.
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!
Relevant xkcd: https://xkcd.com/1168/
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 --help
O(n) access, very efficient.
No, I do not care to share the value of n