this post was submitted on 24 Sep 2025
1270 points (98.2% liked)

Programmer Humor

26570 readers
1763 users here now

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

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Tiberus@lemmy.dbzer0.com 4 points 2 days ago (4 children)

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

[–] merc@sh.itjust.works 6 points 2 days ago (1 children)

With ZSH there's something called "path-completion" that makes that even easier.

Say you want to go to "/usr/local/share/fonts" but that's too much to type out, you can instead type "cd /u/l/s/f" and hit tab. If every path element is unambiguous it will just expand it to "/usr/local/share/fonts". In this case though, "/u/l/" can expand to "/usr/local" or "/usr/lib" so when you hit tab it moves the cursor to just after the "l" to indicate it needs you to distinguish between "/usr/local/" and "/usr/lib". If you just type "o" and hit tab again, it will know that there's only one match for "/usr/lo" and expand that to "/usr/local/" Then there's only one match for "s" which is "share", and only one match for "f" which is "fonts".

That avoids the danger of executing a command with an asterisk wildcard.

[–] snowe@programming.dev 1 points 2 days ago (1 children)
[–] JasonDJ@lemmy.zip 4 points 2 days ago (1 children)

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.

[–] merc@sh.itjust.works 4 points 2 days ago

Or && for if you only want the second command to run if the first command succeeded.

[–] TheOakTree@lemmy.zip 3 points 2 days ago* (last edited 2 days ago)

This only works until you grow an addiction to making pho at home and start documenting your progress.

cd "Pho Recipes and Pictures"

[–] DarkAri@lemmy.blahaj.zone 3 points 2 days ago* (last edited 2 days ago) (1 children)

cd /

sudo rm -rf *

Basically the Linux version of deleting system32 but idk I'm not a super Linux nerd yet.

[–] bandwidthcrisis@lemmy.world 5 points 2 days ago

The fun thing is that you can create a file named "-rf *" and hope an admin tried to delete it!