Questions tagged [zsh]

Zsh is a shell with many advanced command-line and scripting features.

Zsh (the Z shell) is a unix shell.

On the scripting front, zsh and incorporates many of ksh's programming features. Zsh's syntax resembles but is not fully compatible with Bourne-style shells, though zsh has Bourne and ksh emulation modes with compatible syntax and behavior. Zsh's advanced features include many extensions to variable expansion and globbing, associative arrays and more.

For interactive use, zsh's features include advanced line edition, advanced programmable completion, spelling correction, themable prompts and more. Zsh is highly customizable, with many options and tuning possibilities.

The zsh distribution includes add-ons in the form of loadable modules and functions: zmv for batch file renaming, the FTP client zftp, regular expressions, terminal handling, and many more.

Links and documentation

Related tags

  • Many shell-agnostic questions are of interest to zsh users.
  • (or globbing): matching files based on their name
  • a history of commands that can be navigated with the Up and Down keys, searched, etc.; also a recall mechanism based on expanding sequences beginning with !.
  • completion of partially-entered file names, command names, options and other arguments.
  • showing a prompt before each command, which many users like to configure.

Further reading

2989 questions
82
votes
4 answers

What's the newline symbol in zsh's PS1?

I'm trying to setup a multiple line PS1, for zsh, but \n doesn't was parsed by zsh, PS1="%~\n %> " How should I set it up?
daisy
  • 54,555
74
votes
5 answers

zsh: How to check if an option is enabled

To enable an option, we can use setopt. e.g.: setopt extended_glob How can we check if an option is currently enabled ?
Sébastien
  • 967
  • 1
  • 7
  • 11
53
votes
5 answers

What does `zstyle` do?

zstyle seems like it's just a central place to store and retrieve data, like an alternative to export-ing shell parameters. Is that true, or is there more to it?
shadowtalker
  • 1,328
49
votes
6 answers

How can I have two keystrokes to delete to either a slash or a word in zsh?

Bash behaviour I've just migrated from bash to zsh. In bash, I had the following line in ~/.inputrc. "\e\C-?": unix-filename-rubout Hence, Alt+Backspace would delete back to the previous slash, which was useful for editing paths. Separately, bash…
Sparhawk
  • 19,941
44
votes
2 answers

Run the Zsh first use wizard

I made a bad choice when configuring Zsh the first time around, so now I would like to run the configuration wizard (the thing that runs the first time you log in) again. How do I do this?
toryan
  • 707
38
votes
2 answers

How do I check whether a zsh array contains a given value?

Suppose I have a non-associative array that has been defined like my_array=(foo bar baz) How can I check whether the array contains a given string? I’d prefer a solution that can be used within the conditional of an if block (e.g. if contains…
bdesham
  • 1,307
  • 2
  • 13
  • 23
24
votes
1 answer

modifying the zsh shell word split

I am using the word split style shell (select-word-style shell). I like it in general but would like to split at forward slashes also, so that when I go forward/backward a word, if the word doesn't contain any /s, it completely skips over the word…
user23571
  • 251
24
votes
2 answers

watch equivalent in zsh

In bash, watch (e.g. watch -n 5 ls -l) could be used to repeat the command at fixed intervals. This command seem to be missing on zsh. Is there an equivalent?
snowbound
  • 343
22
votes
3 answers

How to configure .zshrc for specfic os

I want to use emacs from Applications folder when I'm using Mac, but I'm using same .zshrc in Ubuntu. alias emacs='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient' So I want to create this alias for only when I'm using OS X. How can I get a…
ironsand
  • 5,205
16
votes
1 answer

Separate path for .zcompdump files

I understand .zcompdump-* files are dumped configuration files that can speed up completion and that can be deleted safely. I would like to store them in a separate location since they clutter my home directory. What's a good way of doing so? I know…
15
votes
1 answer

What does zsh's magic-space command do?

I found the following command in my .zshrc, probably copied from some website: bindkey " " magic-space # do history expansion on space The manpages are about as helpful as the very succinct comment: magic-space Perform history expansion and…
14
votes
1 answer

FPATH in zsh: functions and site-functions

I noticed I have the following line near the beginning of my .zshrc file: export FPATH=/usr/share/zsh/site-functions:/usr/share/zsh/4.2.6/functions:$FPATH I can't remember if I typed this myself or if this line was automatically generated by …
13
votes
1 answer

"--noprofile" or "--norc" functionality in zsh?

Short and sweet: Is there a way to accomplish what --noprofile and --norc bash switches do using zsh?
Ville
  • 351
12
votes
3 answers

How can I use bindkey to run a script in ZSH?

In ZSH, how can I use bindkey to bind a key sequence to a script?
12
votes
1 answer

What does zstyle :compinstall filename do?

The Zsh first-run config wizard usually adds zstyle :compinstall filename '$HOME/.zshrc' to the newly generated ~/.zshrc. What is the purpose of this directive? I could find some documentation on zstyle in general, but not on the specific config…
maxschlepzig
  • 57,532
1
2 3
15 16