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

Programmer Humor

26570 readers
1784 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
 
(page 2) 50 comments
sorted by: hot top controversial new old
[–] ezekielmudd@reddthat.com 12 points 2 days ago (4 children)

Or, just type the command “history”, find the index number of the desired command, then type “! ”, then .

[–] frezik@lemmy.blahaj.zone 12 points 2 days ago

That's way more mental effort than pressing up a bunch of times.

[–] eager_eagle@lemmy.world 8 points 2 days ago* (last edited 2 days ago) (2 children)

or Ctrl+R then search? I don't know why some people still bother with history tbh.

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

Because you can pipe history to grep.

[–] snowe@programming.dev 3 points 2 days ago

with fzf you get better grep with fuzzy search

load more comments (1 replies)
load more comments (2 replies)
[–] pcouy@lemmy.pierre-couy.fr 10 points 2 days ago (1 children)

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.

load more comments (1 replies)
[–] baltakatei@sopuli.xyz 7 points 2 days ago (2 children)

$ history | grep 'gre[p]' | less -S

[–] mbp@lemmy.sdf.org 4 points 2 days ago (2 children)

Does fuck all when you can't remember even a piece of the command lol

load more comments (2 replies)
load more comments (1 replies)
[–] merc@sh.itjust.works 6 points 2 days ago (12 children)

Too many people still use Bash.

load more comments (12 replies)
[–] SexualPolytope@lemmy.sdf.org 9 points 2 days ago (2 children)

In fish, you can enter part of the command, and then press up to search for it. It's kinda awesome.

[–] rozodru@piefed.social 5 points 2 days ago

yeah I ONLY just recently switched to fish after using zsh and oh my zsh for so long - pretty much since first starting linux cause I once saw someone using it on unixporn and I thought "that's cool"

when I switched to NixOS zsh with all the plugins was a total slog. switched to fish and it just HAS everything that zsh/oh my zsh and the various plugins had but baked in.

so yeah in Fish it's just starting to type something and hoping it's still in the history.

load more comments (1 replies)
[–] freewheel@sh.itjust.works 9 points 2 days ago (1 children)

Substring completion on ZSH. Type in a small part of the command you want to find and then press up.

[–] entwine@programming.dev 7 points 2 days ago (1 children)

bash supports this feature too btw

load more comments (1 replies)
[–] UnfortunateShort@lemmy.world 8 points 2 days ago* (last edited 2 days ago)

fish has "directory-aware" autocomplete with inlay hints and a fantastic history command. I do not suffer from such weakness

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

history | grep then !cmd no

[–] desmosthenes@lemmy.world 6 points 2 days ago
[–] flyingSock@feddit.org 8 points 2 days ago

also when they see this post

[–] deacon@lemmy.world 6 points 2 days ago (4 children)

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.

[–] cm0002@lemmy.world 6 points 2 days ago

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

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

You can use Ctrl-R and Ctrl-Shift-R to search through your history instead of having to push up a bajillion times.

load more comments (2 replies)
[–] alecsargent@lemmy.zip 7 points 2 days ago (1 children)

I always go past it because I go way to fast.

load more comments (1 replies)
[–] clashorcrashman@lemmy.zip 4 points 2 days ago

...Yeah, you got me.

[–] titanicx@lemmy.zip 4 points 2 days ago

I'm in this picture, and I didn't like it....

[–] T156@lemmy.world 3 points 2 days ago* (last edited 2 days ago) (2 children)

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.

load more comments (2 replies)
[–] Tiberus@lemmy.dbzer0.com 4 points 2 days ago (5 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 (2 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.

load more comments (2 replies)
[–] 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.

load more comments (3 replies)
[–] Olgratin_Magmatoe@slrpnk.net 5 points 2 days ago* (last edited 2 days ago) (1 children)

grep | history [search term]

[–] Cevilia@lemmy.blahaj.zone 7 points 2 days ago (3 children)

I think you meant history | grep [search term]

(which was id 1003 for me btw)

load more comments (3 replies)
load more comments
view more: ‹ prev next ›