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/Dist__ Jun 12 '26

what's the difference with alias?

u/AiwendilH Jun 12 '26

Fish abbreviations get replaced with the text while you still type the input...so for example if you type ls .dots<space> the .dots get replaced by "/home/simon/dots" the moment you press <space>.

This makes it more useful to abbreviate parts that are reoccurring in the middle of long command lines..like for example abbreviating | sort -ih to quickly add case-insensitive and human number sorting in the middle of a command chain.

u/AnsibleAnswers Jun 12 '26

abbr changes the text on screen to the configured string. You can also place the cursor anywhere in the expanded text with --set-cursor, define where an abbr gets expanded with --position, and set an abbr to be command-specific with --command.

u/Dist__ Jun 12 '26

i see. it's for people who use terminal a lot

u/xplosm Jun 12 '26

Like… you know… every interactive shell

u/Dist__ Jun 12 '26

yeah, but once in week i'm ok to type it, or there's ctrl+R

and if i had to use it every day, this feature might be handy