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

alias ..="cd .." is not needed in fish (shell)...it does that already by default.

Personally I avoid alias as it hides what exact function is created....but that's just a personal preference i guess.

I also like it better to have one file per function in .config/fish/functions instead of all in fish.config, but I again I assume that's more personal preference.

Careful with wall...a command of the same name exists.

I totally agree with you on the usefulness...switching to fish is probably what improved my quality of life in linux most in the last ten years.

u/SandvikDude Jun 12 '26 edited Jun 12 '26

I was wondering why ".." was still working after I removed the functions file I created with funcsave the first time. Does it have that function going more than one directory back as well?

I had a few aliases created in /fish/functions at first, but found it easier to get back to them if needed, if they all were in the main config.fish file.

Thanks for the heads up on the wall command. I'll look it up.

u/AiwendilH Jun 12 '26

The "function" is actually that any directory name you type without anything else fish will cd into. Just type "Documents" in your home directory and fish will change in that directory...

That's why it works with just "..". Every directory has a ".." directory in it that means the directory above. But it's also why it doesn't work with more than one level up...there is no "..." entry fish could use ;). (Hope that makes sense).

wall is probably more used on servers...but I am old enough to still know it as standard command available everywhere. It sends notifications to all connected terminals...similar to what shutdown does to notify everyone. There is a good chance you will not really need it on a single user system...

u/SandvikDude Jun 12 '26

I noticed that just a couple of days ago, that I don't have to cd into directories, which is also a fantastic feature.
But yes, it makes total sense. This is something not present in other shells like Bash or Zsh, correct?

I probably wont be needing the wall command any time soon as it is (like you said) a single user system.
Could also just use Ctrl+Space if I ever needed to use it for some reason.

u/AiwendilH Jun 12 '26

In bash you have to manually enable changing into directories by typing only the name with shopt -s autocd (detail in bash man-page).

zsh has a similar option I think...but not clue if it's enabled or disabled by default, sorry.

u/SandvikDude Jun 12 '26

I probably won't use neither unless it's some copy/paste POSIX stuff. But that's the reach of my knowledge as of now lol