Questions tagged [zsh]

The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a powerful command interpreter for shell scripting.

Questions about the Unix shell zsh (Z shell). Tag with , and for questions about zsh aliasing, command completion and configuration respectively.

The Z shell can be used as an interactive login shell and as a powerful command interpreter for shell scripting. It can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh. However, it does not provide compatibility with POSIX or other shells in its default operating mode.

Apple's macOS switched to Zsh as the default shell for new accounts in macOS Catalina (2019). Previously, the default interactive shell was Bash (which still remains available as an option, albeit at a rather dated version).

Origin
The first version of zsh was written by Paul Falstad in 1990 when he was a student at Princeton University.

Features
Features of note include:

  • Programmable command line completion that can help the user type both options and arguments for most used commands, with out-of-the-box support for several hundred commands
  • Sharing of command history among all running shells
  • Extended file globbing allows file specification without needing to run an external program such as find
  • Improved variable/array handling
  • Editing of multi-line commands in a single buffer
  • Spelling correction
  • Various compatibility modes, e.g. zsh can pretend to be a Bourne shell when run as /bin/sh
  • Themeable prompts, including the ability to put prompt information on the right side of the screen and have it auto-hide when typing a long command
  • Loadable modules, providing among other things: full TCP and Unix domain socket controls, an FTP client, and extended math functions
  • Fully customizable

Attesting to the sheer size of this shell is the famous first sentence of the shell's manual page, which reads "Because zsh contains many features, the zsh manual has been split into a number of sections", and then goes on to list seventeen items.

Documentation

The ZSH completion system

ZSH settings

5953 questions
150
votes
28 answers

Zsh: Conda/Pip installs command not found

So I installed Anaconda and everything is working. After I installed it I decided to switch to oh-my-zsh. I am now getting: zsh: command not found: conda when trying to use pip or conda installs echo $ZSH_VERSION 5.0.5 I have added to my…
Architek1
  • 2,051
  • 3
  • 15
  • 17
149
votes
10 answers

macOS Catalina 10.15(beta) - Why is ~/.bash_profile not sourced by my shell?

I want to set the environment variable I added below the line to ~/.bash_profile and ~/.profile but it didn't work. export JBOSS_HOME=/Users/{USERNAME}/Desktop/jboss7 Afterward, exit the terminal and open it again when executing echo $JBOSS_HOME I…
Reza Dehnavi
  • 2,256
  • 3
  • 16
  • 30
144
votes
3 answers

What does "export" do in shell programming?

As far as I can tell, variable assignment is the same whether it is or is not preceded by "export". What's it for?
John Bachir
  • 22,495
  • 29
  • 154
  • 227
139
votes
4 answers

Exit zsh, but leave running jobs open?

Just switched from bash to zsh. In bash, background tasks continue running when the shell exits. For example here, dolphin continues running after the exit: $ dolphin . ^Z [1]+ Stopped dolphin . $ bg [1]+ dolphin . & $ exit This is…
Owen_AR
  • 2,867
  • 5
  • 20
  • 23
123
votes
3 answers

Oh My Zsh - Disable 'Would you like to check for updates' prompt

Every time I open up terminal on a Mac I get the prompt Would you like to check for updates? I find it quite annoying. Anyway to stop it from doing so?
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
122
votes
5 answers

How can you export your .bashrc to .zshrc?

I am trying to move to zsh from bash. I copied my .bashrc directly to my .zshrc, and it caused a lot of errors when I tried to use bash again. How can you export your .bashrc to .zshrc?
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
122
votes
4 answers

Making ZSH default Shell in MacOSX

I installed zsh on my Mac. and now i want to make it the default shell instead of Bash. But I seem to be running into the following error: $ echo $SHELL /bin/bash $ chsh -s /usr/bin/zsh Changing shell for harshamv. Password for harshamv: chsh:…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
115
votes
14 answers

After upgrade MacOS terminal showing: zsh: command not found: flutter

Recently I updated Mac OS to latest Catalina. Now when entering a flutter command like the following, flutter --version my terminal (which is using zsh) shows me following error: zsh: command not found: flutter How do I reinstate the path to allow…
Code Hunter
  • 10,075
  • 23
  • 72
  • 102
112
votes
2 answers

What does autoload do in zsh?

I wasn't able to find a documentation for the widely used autoload command in zsh. Does anybody can explain it in plain English? A bit more specific: What does autoloading of modules mean, for example in this line: autoload -Uz vcs_info What does…
BairDev
  • 2,865
  • 4
  • 27
  • 50
112
votes
3 answers

zsh history is too short

When I run history in Bash, I get a load of results (1000+). However, when I run history the zsh shell I only get 15 results. This makes grepping history in zsh mostly useless. My .zshrc file contains the following…
NVaughan
  • 1,595
  • 2
  • 9
  • 23
112
votes
4 answers

Make iTerm2 launch with Zsh

I've been digging through iTerm2's settings but I can't seem to find a way to make it launch Zsh instead of Bash, does anybody know the proper way to do this inside iTerm2? I ask this because I come from Mac Terminal, and it easily lets you choose…
greduan
  • 4,770
  • 6
  • 45
  • 73
110
votes
31 answers

Rails keeps telling me that it's not currently installed

I use rvm to manage different rubies and their gemsets. My shell is zsh with oh-my-zsh configured with basic settings. Enabled oh-my-zsh plugins are ruby, rails, osx, and git. Here's the command I used to install ruby-1.8.7 and rails-3.0.7. rvm…
nil
  • 3,421
  • 2
  • 21
  • 21
109
votes
6 answers

Can a Bash tab-completion script be used in zsh?

I have a Bash tab-completion script for Apache's Hadoop. Normally, I use zsh as my day-to-day shell. It tends to be pretty bash-like when I need it to be, but it looks like the tab-completion systems are radically different between them. Is there…
Coderer
  • 25,844
  • 28
  • 99
  • 154
105
votes
16 answers

ZSH: Hide computer name in terminal

How would I hide the computer name in the prompt while using the terminal? At the moment it shows both username and computer name like so: It would save some space by removing anwarchoukah@anwars-mbp, seeing as I actually know who I am:)
achoukah
  • 1,345
  • 2
  • 10
  • 10
104
votes
7 answers

How to remove an entry from the history in ZSH

Let's say I ran a command using a zsh echo "mysecret" > file I can easily print the history including the entry numbers using the command fc -l: 1 echo "mysecret" >| file But how can I easily delete an entry from the history? I cannot find a…
sandoz
  • 1,177
  • 2
  • 7
  • 6