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
196
votes
2 answers

How do I delete/remove a shell function?

I have done this: $ z() { echo 'hello world'; } How do I get rid of it?
too much php
  • 88,666
  • 34
  • 128
  • 138
195
votes
2 answers

Where to place $PATH variable assertions in zsh?

I love zsh, but I am not sure where to place my $PATH and other variable assertions? I find that they are scattered between the files .zshrc .zprofile .bashrc .bash_profile, and sometimes doubled. I realize that having anything inside the bash files…
stefmikhail
  • 6,877
  • 13
  • 47
  • 61
193
votes
6 answers

Worth switching to zsh for casual use?

The default shell in Mac OS X is bash, which I'm generally happy to be using. I just take it for granted. It would be really nice if it auto-completed more stuff, though, and I've heard good things about zsh in this regard. But I don't really have…
Will Robertson
  • 62,540
  • 32
  • 99
  • 117
191
votes
6 answers

ZSH alias with parameter

I am trying to make an alias with parameter for my simple git add/commit/push. I've seen that a function could be used as an alias, so I tried but I didn't make it. Before I had: alias gitall="git add . ; git commit -m 'update' ; git push" But I…
albttx
  • 3,444
  • 4
  • 23
  • 42
191
votes
14 answers

oh-my-zsh slow, but only for certain Git repo

I recently started using Zsh and it's awesome. Unfortunately, for the project I consider my "main" project, everything is slow. What I mean is that every time I run a command - ls, for example - there's about a five-second delay between the time the…
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
188
votes
27 answers

Conda command not found

I've installed Miniconda and have added the environment variable export PATH="/home/username/miniconda3/bin:$PATH" to my .bashrc and .bash_profile, but still can't run any Conda commands in my terminal. Am I missing another step in my setup? I'm…
olivrg
  • 5,523
  • 3
  • 15
  • 19
185
votes
7 answers

Git tab completion not working in zsh on mac

No matter what I try and do I can't seem to make git tab/auto completion work in my zsh shell. I've downloaded the bash-completion script and the zsh-completion one and followed the instructions, but I can't make it work. I've reinstalled oh-my-zsh…
hamchapman
  • 2,901
  • 4
  • 22
  • 37
177
votes
20 answers

Homebrew’s `git` not using completion

When using OSX’s git, after I modify a file I can simply do git commit , and that’ll auto complete the file’s name to the one that was modified. However, if I install a newer version of git from homebrew and I use it, that feature no longer…
user137369
  • 5,219
  • 5
  • 31
  • 54
175
votes
6 answers

Comments in command-line Zsh

I switched from Bash to Zsh on Ubuntu and I'm quite happy about it. However, there is something I really miss and I did not find how to achieve the same thing. In Bash, whenever I was typing a long command and noticed I had to run something else…
fbiville
  • 8,407
  • 7
  • 51
  • 79
172
votes
1 answer

zsh: no matches found: requests[security]

I am trying to run a python urllib2 script and getting this error: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For…
Kristen
  • 1,731
  • 2
  • 11
  • 7
171
votes
5 answers

ZSH complains about RVM __rvm_cleanse_variables: function definition file not found

When using the latest ZSH and RVM on Mac OS X 10.7.4 ZSH complains about this: __rvm_cleanse_variables: function definition file not found
Tyler Brock
  • 29,626
  • 15
  • 79
  • 79
162
votes
12 answers

npm global path prefix

I am being more cautious than usual because I have been confused by the behavior of npm in the past. I am on a Mac and have installed node.js through brew install node. Now that I want to run jslint.js on the command-line as the command jslint I…
Steven Lu
  • 41,389
  • 58
  • 210
  • 364
159
votes
32 answers

Command not found after npm install in zsh

I'm having some problems installing vows via npm in zsh. Here's what I get. I tried installing it with and without the -g option. Do you have any idea what's wrong here? [❤ ~/Desktop/sauce-node-demo:master] npm install -g vows npm http GET…
optikfluffel
  • 2,538
  • 4
  • 20
  • 27
155
votes
4 answers

ZSH iterm2 increase number of lines history

Not sure if this is zsh, iterm2 or the interaction between them. Trying to change the number of recallable lines in the terminal - not the command history, the output history. In .zshrc I have…
xxjjnn
  • 14,591
  • 19
  • 61
  • 94
152
votes
6 answers

How to make zsh run as a login shell on Mac OS X (in iTerm)?

When zsh is set as a login shell on Mac OS X, when it is started by iTerm, zsh doesn't consider that it's being run as a login shell, although it's started as ‘-zsh’ (‘-’ is put as the first character of arg[0]) which is supposed to mean that it…
Ivan Tarasov
  • 7,038
  • 5
  • 27
  • 23