Change default shell from bash to zsh by default?

zsh is great, but why default? A person can type zsh and be using zsh. Maybe if Debian accepts this as default it would make sense but the least differences from Debian as possible for Whonix seems a good policy.

1 Like

I agree, as I scrolled I didn’t expect to see it was actually merged.

Yeah that was a surprise. But I’m not sure if the merge made it the default or just included it. I never tested before if it was included. It is now, but maybe that was the merge?

desktop-config-dist/etc at master · Kicksecure/desktop-config-dist · GitHub - it’s in there

Merged was zsh configuration enhancements.

zsh has better usability, better command completion and highlighting. Any issues?

Not enabled yet by default due to this issue Change default shell from bash to zsh by default? - #41 by Patrick

But I have an idea now how to solve this. Maybe a systemd unit can help here.

Enabling this by default will be done through package dist-base-files, not desktop-config-dist because dist-base-files creates Linux user account user.

Please move this to separate discussion in a dedicated forum thread if needed.

Some command line commands are incompatible with bash.

curl --tlsv1.3 --proto =https --max-time 180 --output ~/derivative.asc https://www.whonix.org/keys/derivative.asc

zsh: https not found

It works when using quotes.

curl --tlsv1.3 --proto "=https" --max-time 180 --output ~/derivative.asc https://www.whonix.org/keys/derivative.asc

But non-ideal.

Any way to make zsh command prompt bash compatible?

Usability.

Zsh autosuggestions is much better than backwards search for both bash and zsh. You can complete commands based on history and what you have typed so far.

Zsh syntax highlighting highlights in red wrong commands (not arguments), thus instead of clicking enter to see if that the command was not found, you correct the typo in the first word/command until it is green or install the program that provides the command.

Zsh corrects line endings and prints % when there is no newline at the end of the message, thus not destroying the prompt format as it happens on bash, that you think you’ve typed that right characters, but the shell did not receive what you are seeing on your terminal. It is possible to fix this for bash, but it is not the default behavior.

Zsh menuselect completion is much easier to navigate than Bash’s completion. Zsh completion can also have a description of the option you are completing so you know what you are adding as an argument.

There are many other things, but the points I mentioned above are usable for new users, they only need to use .

I see the point of keeping close to Debian defaults as a policy on various matters, but the Interactive shell doesn’t affect scripts, only what the user interacts with.

The terminal is already scary for the users, I want it to be easy to everyone use.

1 Like

This was also unexpected to me.

setopt noequals fix this.

Zsh is not a bourne shell, its syntax is different. I didn’t expect this error because the option equals is enabled by the default.

1 Like
1 Like

Thanks! Merged. Will test this from now on.

While I see your point and commend your work, there is a strong argument for moving away from terminals for average users. A simple misstep (oops I actually pressed enter on rm -rf in my home directory before I filled out the path) can cause somewhat catastrophic issues

I would argue for creating UI solutions whenever possible. It might be worth it looking in to things in Whonix that can only be done via the shell at some point.

A bit off topic, just pontificating. Zsh default is solid.

2 Likes

Also off-topic, there’s also Debian -- Package Search Results -- safe-rm and Debian -- Package Search Results -- trash-cli which one day can be considered for installation by default and to replace rm in documentation.

Status of zsh by default in Whonix:


  • Non-Qubes-Whonix new builds: zsh is enabled by default since Whonix 17.



  • User choice: Users can configure bash, zsh or any other shell of their choice as per the usual mechanism in Debian. Also documented here, See Default Interactive Shell in Kicksecure wiki.
    (Whonix is based on Kicksecure.)

related source code file for enabling zsh by default:
https://github.com/Kicksecure/dist-base-files/blob/master/debian/dist-base-files.postinst

bug:

sudo apt purge firefox*

zsh: no matches found: firefox*
zsh: exit 1 sudo apt purge firefox*

Need to use quotes.

sudo apt purge "firefox*"

This was functional with bash.

Fixable?

1 Like

Thank you, merged!

This issue was solved but there’s a new issue…

…the newuser module is back for Qubes-Whonix 17 templates.

(Same message as in post Change default shell from bash to zsh by default? - #37 by Patrick)

Reported here:
Qubes-Whonix: enable zsh by default · Issue #8343 · QubesOS/qubes-issues · GitHub

Resolved. Now zsh gets enabled by default everywhere.

  • Non-Qubes-Whonix
  • Qubes-Whonix
  • existing (upgraded) builds