zsh
Start the Z shell
TLDR
Start an interactive shell session
Execute specific [c]ommands
Execute a specific script
Check a specific script for syntax errors without executing it
Execute specific commands from stdin
Execute a specific script, printing each command in the script before executing it
Start an interactive shell session in verbose mode, printing each command before executing it
Execute a specific command inside zsh with disabled glob patterns
SYNOPSIS
zsh [options] [command_file | -c string | -s | -i] [arguments...]
PARAMETERS
-c string
Execute commands from string.
-i
Force interactive mode.
-l
Make the shell act as a login shell.
-s
Read commands from standard input.
-f
Avoid defining functions when reading command files.
-n
No execute mode. Read commands but do not execute them.
-v
Verbose mode. Print shell input lines as they are read.
-x
Trace mode. Print commands and their arguments as they are executed.
-o option
Set a shell option. (e.g., -o vi)
+o option
Unset a shell option.
-D
Define a global integer variable.
-E
Expand words before parameter assignment.
-m
Monitor mode (job control).
-q
Quiet mode.
-t
Read and execute one command.
--version
Display version information.
DESCRIPTION
Zsh is a powerful command interpreter (shell) usable as an interactive login shell and as a shell script command processor. It's a superset of sh (Bourne shell) with many enhancements, including command line editing, programmable command completion, spelling correction, shell functions, aliases, a history mechanism, and a large number of built-in commands. Zsh offers a rich set of features for customization and is highly configurable through its extensive options and plugins. It aims to provide a user-friendly yet flexible environment for both interactive command-line work and automated scripting. Its powerful scripting capabilities make it suitable for complex system administration tasks and automation. Zsh is widely regarded for its customizability and extensive plugin ecosystem, such as Oh My Zsh, which provide themes, plugins, and functions to greatly enhance the user experience.
CAVEATS
Zsh's configuration files (.zshrc, .zprofile, .zlogin, .zlogout) can become complex, requiring careful management. The shell's extensive features can also lead to unexpected behavior if not properly understood.
STARTUP FILES
When zsh starts, it executes commands from various startup files depending on how it's invoked. If it's a login shell, it reads /etc/zprofile followed by ~/.zprofile, ~/.zlogin, and then ~/.zshrc. For interactive shells, it reads /etc/zshrc and then ~/.zshrc. Non-interactive shells read only the file specified by the ZDOTDIR variable, or ~/.zshrc if ZDOTDIR is not set.
OPTIONS
Zsh has a vast number of options that control its behavior. These can be set or unset using the `set` builtin command. Some commonly used options include `autocd`, `correct`, `histignorealldups`, `ignoreeof`, and `noclobber`.
HISTORY
Zsh was first written by Paul Falstad in 1990 while a student at Princeton University. The name zsh was chosen because Professor Shen Lin, one of Falstad's professors at Princeton, had the login ID `zsh` on the school's computers.
Over the years, zsh has gained a large community of users and contributors, resulting in a highly feature-rich and customizable shell.
It is now a popular choice for users seeking a powerful and flexible command-line environment.