r/linux4noobs Jun 12 '26

shells and scripting Fish shell abbreviations is a godsend

Hi!

After my migration from Windows to Linux two or so months ago, I've been trying to learn how to use the terminal and be somewhat efficient and know about the basic functions like rm, mv, cp, ls, ln and such.
I've known about terminal aliases a while, but I found out about abbreviations on Fish yesterday and I absolutely love that feature.

Got any suggestions on other abbreviations/aliases I should use, or even other QoL features that I might not know about? Happy to learn!

Upvotes

64 comments sorted by

View all comments

u/howmuchiswhere Jun 13 '26

i have an abbr for setting abbr on the fly. a lot of times i'll be doing something as a one off so i don't want to add something to my fish config because i'll definitely forget to remove it later. creating them from the command line means they will be forgotten when the shell session ends.

    abbr --add --set-cursor abbrp "abbr --add --position anywhere %"
    abbr --add --set-cursor abbrc "abbr --add --set-cursor %"

and it turns out i've got a bunch that i wish i'd remembered because i'd use them all the time.

    abbr --add --position anywhere devn "&> /dev/null"
    abbr --add --set-cursor fh "find ./ -iname '*%*' | sort"
    abbr --add --set-cursor fhf "find ./ -type f -iname '*%*' | sort"
    abbr --add --set-cursor fhd "find ./ -type d -iname '*%*' | sort"
    abbr --add --position anywhere --set-cursor awkp "| awk '{print %}'"
    abbr --add --position anywhere --set-cursor seds "| sed 's/%/g'"
    abbr --add --position anywhere wlc "| wl-copy"
    abbr --add --position anywhere --set-cursor igrep "| grep -i -E '%'"
    abbr --add --position anywhere --set-cursor vgrep "| grep -v -i -E '%'"

pipes are particularly handy, it's like snippets for the shell.

u/SandvikDude Jun 13 '26

Gonna be honest with you... This looks a bit too complicated for me at the moment lol

u/howmuchiswhere Jun 13 '26

ahh sorry, you seem savvy enough, but maybe what's intuitive to me is just a mess to you, and vice versa. to be honest, i think there's a reason i don't use these, and it's that it's more complicated than just doing the thing ha.

u/SandvikDude Jun 13 '26

I don't mind hard and complicated (lol, I know), but my brain is working overtime already with all of this new Linux stuff. I'll get there eventually, but I have to get through the basics first I think.

But yes, I do think you answered your question on why you don't use them yourself. In what scenario would you need these?