history | grep then !cmd no
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
You have to be a linux user to use the console now?
zsh tab completion also looks through history wich is pretty nice.
I accidentally found out one day that I could use a wildcard operator in the terminal instead of a full file or folder name due to always doing this.
cd Pho* or cd /documents/Pho*
Will for example open my "Photo Examples" folder in the working directory or based on the path
You can use ||
between two commands as well. If the first command returns exit code != 0, the second command will run.
I.e. which ansible || pip install ansible
.
Or && for if you only want the second command to run if the first command succeeded.
cd /
sudo rm -rf *
Basically the Linux version of deleting system32 but idk I'm not a super Linux nerd yet.
The fun thing is that you can create a file named "-rf *" and hope an admin tried to delete it!
This only works until you grow an addiction to making pho at home and start documenting your progress.
cd "Pho Recipes and Pictures"
I'm in this picture, and I didn't like it....
...Yeah, you got me.
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.
- zsh-autosuggestions
history | fzf
alias cat="bat --plain --theme=gruvbox-dark"
Being able to just enter a partial command, and hit [up] to jump to prior commands that started in the same way in zsh is a godsend.
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.
Oh come on! I at least type the beginning so that it filters the history
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?"