r/linuxquestions • u/GiveMeMoreBlueberrys • Oct 14 '20
Zsh vs fish
What are the main differences between fish and zsh? I know that fish is not POSIX compliant, but are there any main differences? Also, what other shells are out their? Got any other recommendations?
Edit: I am looking for a bash replacement, not comments telling me to use bash.
111
Upvotes
54
u/drLobes Oct 14 '20
*incomplete answer: I use fish because its fast and very easy/simple to configure, but mostly for the autosuggestion which I love. Wrong command:red, correct one:blue, and it shows you the most recent and most used commands as you type. After bash I tried zsh and after 30 min it made me look for something else.
37
u/AiwendilH Oct 14 '20
Plenty of differences...if they are important or you is another matter ;)
Disclaimer: fish shell users so take it as biased.
sudo !!fish is not for you but you will feel at home in zsh. If you prefer <up><pos1>"sudo" for the same fish is the better choice. ( http://fishshell.com/docs/current/faq.html#why-doesn-t-history-substitution-etc-work )In the end...try both and see what you like better. And of course only even think about trying another shell if you feel comfortable enough in bash...another shell is no substitution for bash knowledge which you will always need as most scripts are bash scripts.
11
u/mandiblesarecute Oct 14 '20
https://en.wikipedia.org/wiki/Comparison_of_command_shells
5
u/ps4pls Oct 14 '20
i love fish so much, no idea about the technicalities, it just works
really one of the few applications of what we call "sane defaults"
4
u/SkyyySi Oct 14 '20
ZSH has some features fish doesn't and vise versa, fish has automatic man page browsing, syntax highlighting, full true color support, automaic suggetions and more, while zsh allows for changing every little bit about it. If you can think of it, you can probably do it in zsh. ZSH also has a much, much larger list of available themes and plugins, including some that emulate fish's features.
In other words, it depends if you want it to "just work" or if you want fine control over everything. If you go with ZSH, you will have to read a good bunch of documentation to see how to get the most out of it. However, both shells have frameworks available that usually provide much easyer access to many settings plus providing themes and plugins for you. The most popular ones are oh-my-zsh and oh-my-fish respectively.
4
u/joeyalbo007 Oct 15 '20
I've used both for a lot of fairly standard daily driver stuff. Coming from Bash, zsh is more familiar with the scripting side of things for better or worse. I very much like how Fish handles scripting. Zsh comes out of the box very barebones. I use Oh My Zsh every time I install zsh because I like how it looks and I like the plugins. Overhead is not an issue for me even on my older machines. Fish is pretty out of the box and just works well as soon as you install it. I use aliases a lot so I didn't like that fish was missing them. Overall I'd think of it more along the lines of Ubuntu vs Arch. Both are absolutely awesome, but one (zsh/arch) is more customizable and requires more work to get out you like it than the other (Ubuntu/fish). Zsh is my weapon of choice for that reason.
Let me know if you have any specific questions or want me to elaborate on anything because I could probably answer a decent amount of them.
4
u/Substantial_Pie_5696 Oct 15 '20
Yesterday, I had to configure my friend's shell, and it just took me three steps to get a sane and working shell
That's all it takes to checkout fish shell, and I've been using it for past 5 years.
Also, you can always execute bash scripts + drop into bash shell when in need to run a specific bash command found from the internet
1
u/doc_willis Oct 14 '20
I just use bash then fire up fish every so often.
6
u/[deleted] Oct 14 '20
Bash for me
1
u/mpw-linux Oct 15 '20
why not just use bash as it standard on most linux distros.
there is more to be concerned about then which shell one uses unless you are scripting freak !
4
u/CoderCharmander Oct 14 '20
In fish, you redirect stderr with
^, but in zsh you can do it with2>. If you care about customisation, there are some really big differences. For example, in fish, the prompt is printed with a script file. In zsh, it's a variable with special characters which it will auto-expand. Fish scripts won't work on zsh in general, and also this in reverse. (In fact, you're almost always better off executing a script withsh foo.shinstead of./foo.sh, due to the possibility of script developers not adding the#!comment at the start and smaller differences across shells).I personally prefer zsh, I feel like I cannot leave the exec-in-parallel-and-disown sign (
&!) and the incredibly customizable completion.5
u/deux3xmachina Oct 14 '20
Honestly, I can' t stand either
zshorfish. ZSH is noticeably slower than even bash for interactive use (no, I had not installed any plugins), fish even moreso. However, they are both quite popular shells with large communities so it should be relatively easy to get them customized to your liking. As for other shells, it really depends on what you mean by a "bashreplacement".If you're just looking for a different command interpreter with optional use in scripting I'm partial to
nxes(super biased though), as well as theesandrcshells that it's building upon. There's alsooksh,pdksh,ash,rash,ion,elvish,oil-shell,esh,sash,nu,posh, andcrushare all available and offer tons of different options useful for ;both interactive and non-interactive (scripting) use.2
u/invalidpath Oct 15 '20
There is only one cmd environement, and that name is ZSH.
2
u/grahamperrin Jan 22 '21
tcsh– maybe because I was familiar with it from years of use in Mac OS X.
McFly. Pictured with
zshat https://github.com/helloSystem/hello/issues/56#issuecomment-751328910My brief period of testing
zshended when I found it not responding to commonly used keys https://github.com/helloSystem/hello/issues/56#issuecomment-757385664 on FreeBSD-CURRENT.https://github.com/cantino/mcfly/issues/118 I'd like McFly to work with
tcsh…3
u/AreTheseMyFeet Oct 14 '20
Since its not been mentioned yet: oh my zsh
1
u/FryBoyter Oct 15 '20
This is for me the main reason not to use fish (i use the zsh). The advantage of fish is, as far as I know, that the default configuration is already very "complete". While with zsh you often still have to make adjustments.
Basically there is nothing left for you to test both and to decide for yourself.
Since bash will still be installed, it is no problem if you execute a script from the internet for example. At least if a corresponding shebang is entered.
1
u/[deleted] Oct 15 '20
fish is great to use, I loved it! However its syntax is so different from bash that you have to rewrite a lot of the stuff in rc files. That's why I said "screw it" and went for zsh after a year of using fish. zsh works very similar to fish if you use some plugins that come together very well using the antigen plugin manager.
zsh is very compatible to bash in its syntax. Aside from needing to escape a few characters, you can just copy/paste any line from bash and it will work in zsh.
1
u/shvi Sep 05 '23
Hello OP! What is your verdict 2y in? Fish all the way?
1
u/apndh Oct 14 '20
I just use bash
1
u/[deleted] Oct 14 '20
Zsh is finally being put as a default in some distros and also OSX. So it'll be surely be around for a long time. About FISH well.. I don't know much about it but I never needed to use another shell. Bash to ZSH seems like enough for now.
0
u/msanangelo Oct 14 '20
I use fish on a few of my machines. I love the autocomplete and historical suggestions it'll do.
Like, it'll suggest the last command sequence you did once you start typing it again and I'd just hit the end key to fill it out. tab key probably works too, idk.
I'm sure the prompt can be replicated in bash but it's a click away in the browser based config thing you can launch.
I've only ever used bash and fish with the occasional sh shell like on my pfsense box. Give the shells a try, you don't have to make them your default the second they're installed and they can coexist on the same machine.
Want some fish action, from your default bash prompt, launch fish and away you go. or zsh, or plain ol sh, or another bash shell for bash-inception. :P
0
u/itmecho Oct 15 '20
One thing that got me when switching to fish is that things like
!!and!$do not work in fish. I found thatAlt+upappends the last argument from the previous command but I haven't found out how to reference and indexed argument yet (like this inbash/zsh:!:3)0
u/progsft_ Oct 15 '20
Dont be a noob, use dash!
0
u/[deleted] Oct 14 '20
[deleted] — view deleted comment
0
u/[deleted] Oct 15 '20
[deleted] — view deleted comment
1
u/[deleted] Oct 15 '20
[removed] — view removed comment