this post was submitted on 24 May 2024
13 points (93.3% liked)

Linux

5280 readers
688 users here now

A community for everything relating to the linux operating system

Also check out [email protected]

Original icon base courtesy of [email protected] and The GIMP

founded 1 year ago
MODERATORS
 

So I'm currently using zsh + oh my zsh, and have been using it for some years now. It's good, it has amazing features (via plugins) and overall I'm happy with it. But lately it has become laggy for me (probably because of plugins) and I want to see if there's any other shell with features like ZSH but faster and lighter?

I've tried Fish, and usually install it on my servers, but it's not POSIX compliant so learning what commands actually do what in Fish seems like a hassle.

I've heard of Oilshell, Yash, Nushell but haven't tried any of them.

What is your setup for your interactive shell?

top 19 comments
sorted by: hot top controversial new old
[–] [email protected] 17 points 6 months ago

Ditch oh my zsh, install the plugins directly.

Because zsh is very fast and light. I'm using it with only a handful of plugins, manually installed, and starship

[–] [email protected] 12 points 6 months ago

It wouldn't be fair to say zsh is slow because ohmyzsh is slow. ohmyzsh is notorious for being a bit bloated. If you pull the whole thing, it makes a mess of your shell and you really can't tell anymore what is what.

It's possible to install the individual stuff you need from oh my zsh without pulling the whole thing.

I am a happy antidote user. With it, you can do something like this on your zsh_plugins.txt file:

ohmyzsh/ohmyzsh path:plugins/extract

Though ohmyzsh provides its own means to enable and disable plugins, this will allow you to cut that down to the pulling only of individual plugins in the first place.

Your mileage may vary, but other plugin managers may give you different ways to accomplish the same.

zsh is quite an advanced shell. You will find other shells that do things radically different and have their own bells and whistles, but if you are going for feature parity it may be hard to find a replacement.

[–] [email protected] 9 points 6 months ago

fish shell, with starship prompt, fzf nothing fancy there, works for me

[–] Feyd 7 points 6 months ago

I use fish. I really like that it is already configured to be a comfortable and usable interactive shell out of the box.

The differences from posix are generally easier to remember on the fish side imo (like if statements) and you generally only encounter them when you write scripts.

You can also write scripts in bash if you want and there is a nice tool if you need to put environment variables into shell from a bash script (https://github.com/edc/bass)

[–] Kissaki 5 points 6 months ago (1 children)

It's not POSIX either, but I'll answer your closing question: My current shell of preference is Nushell.

[–] [email protected] 2 points 6 months ago (1 children)

Does it need to be POSIX? Isn't that only for compatibility with really old Unix systems.

[–] Kissaki 1 points 5 months ago (1 children)

Yeah. But OP specifically mentioned them disliking Fish because it's not POSIX.

[–] [email protected] 1 points 5 months ago

Fair! I missed that.

[–] [email protected] 5 points 6 months ago

I switched from Zsh to Nushell almost two years ago and I have never looked back. If you need POSIX compliance, Nushell is a no go. But it sounds like your real problem was just that Zsh was familiar whereas fish was not. Nushell strikes the perfect balance of offering the commands you’re used to but letting everything just make intuitive sense. Plus, its help command is so far above and beyond other shells. I rarely need to open the Nushell docs (even though they’re really good), and I never have to go the community (even though it’s awesome), because I can figure pretty much everything out just from interacting help within the terminal.

[–] sudo 2 points 6 months ago* (last edited 6 months ago)

Fish, no plugins. The POSIX differences are to your advantage when using interactively. Its amazing how much larger expressions you can construct in the repl before you start moving to a proper file. Its like moving from pure mysql or psql to mycli or pgcli.

When you add it all up, the amount of effort you'll expend to learn fish are small compared to the amount of effort you'll save by trying to recreate the UX with plugins and custom scripts.

[–] [email protected] 2 points 6 months ago (1 children)

Bash. I used ZSH for a while too, but without Oh My Zsh, installing only a handful of plugins manually (or I used a simple plugin manager, honestly forgot if). It was nice, but I had ton of stuff that was not really necessary. And with the next OS install I decided to try a Bash only system. And you know what, it feels so much better and I appreciate simplicity a bit more than before.

But I think you won't go back. Fish is nice first, but it's too different from Bash and Zsh. I had constantly think about the differences and most of my scripts are Bash anyway. So I did not want to have a scripting language that is different from interactive shell. A language like Fish is too similar, while being different. This messes with my brain, the language itself seems to be fine.

What's left? PowerShell... nah, just joking. The problem is, most are different languages and not like Zsh and Bash at all. You listed Nushell, there is also a Python like shell language Xonsh. There is also a C like one Csh But to be honest, if you want a POSIX compliant one, then you don't have much to choose from. Either start your ZSH setup from scratch, with the knowledge you have now, or go back to Bash. That's what I did and kept using it since.

[–] fourwd 2 points 6 months ago* (last edited 6 months ago) (2 children)

Bash has a very strange sequence of sourcing scripts like .bash_profile and others, and the type of shell (interactive or not) adds fuel to the fire. There is no chance to sort through this bunch of init files in order to correctly and conveniently set up environment variables. In zsh, only 3 files are needed for proper configuration; it couldn’t be easier.

[–] [email protected] 2 points 6 months ago (1 children)

There is no chance to sort through this bunch of init files in order to correctly and conveniently set up environment variables.

Just use .bash_profile for environmental variables. This file is loaded up each time you login. I use Bash for quite some time now with this file and there is no need to go through various sourced init files. This is the file you need.

There is also a system wide universal file dedicated to all shell environmental variables: /etc/environment . This file however is not a script and it does not understand variables either; as this is the first that runs. But this is active for all users and all shells.

When I used Zsh it was not better than Bash to setup environmental variables, so not sure why you think one or the other is less complicated.

[–] fourwd 2 points 6 months ago (2 children)

so not sure why you think one or the other is less complicated

Because of this:

And some note by the author of the scheme:

Unfortunately, the operation of bash startup scripts is dependent on patches added by OS distributions

Why should I guess at the tea leaves instead of just using deterministic zsh?

[–] [email protected] 3 points 6 months ago

Weird I don't have to think about all these graphs. It can be as complicated as you make it to. I use Linux since 2008 and most of the time was Bash (with a few years of Zsh in between) and there is no such problem in real world. At least for me. And I am a person who constantly writes scripts and would get in trouble if env vars are not set correctly or something like that. From my experience Zsh was as messy as Bash and I had the same troubles with it setting env correctly.

[–] suy 2 points 5 months ago

I have to admit that I never understood the need for bashrc and bash_profile. I hated that with a passion when I started to set up my bash configuration. I never saw the need to have so many files and so much complication to have a consistent shell whenever I logged in the console or spawned a konsole in KDE.

The paths shown on that diagram are 7 for bash, and 4 for zsh, so it's surely an improvement. However, now that I have set it all on a git repository, I don't see it as a big deal. I have a profile that sources bashrc, and then I do it all in bashrc. I've checked /etc/skel and it seems the distro does roughly the same (and I've never switched away from Debian or Debian-based in 20 years). I'm not sure if it's such a big deal. But I'm still curious about trying zsh some day. :)

Thanks for the blog post. I'll check it out.

[–] Scoopta 1 points 6 months ago

Environment variables are easy to setup in bash? It's never been anything other than straightforward in my experience

[–] fourwd 2 points 6 months ago

Why don't you just remove all plugins and use standard zsh? All sorts of oh-my-soy are not really needed.

[–] oscar 1 points 5 months ago

Drop oh-my-zsh and look for something else to customize your prompt. I like Powerlevel10k but Starship is good too.