Linux command
zsh 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start an interactive zsh shell
zsh
Execute a script
zsh [script.zsh]
Execute a command
zsh -c "[command]"
Start without loading config files
zsh -f
Start a login shell
zsh -l
Check script syntax
zsh -n [script.zsh]
说明
zsh (Z Shell) is an extended Bourne shell with many improvements, combining features from bash, ksh, and tcsh. It offers powerful completion, theming, and scripting capabilities. Zsh is highly configurable through ~/.zshrc for interactive settings and ~/.zshenv for all shells. Framework projects like Oh My Zsh and Prezto provide pre-configured themes and plugins. Key features include advanced tab completion (programmable and context-aware), spelling correction, shared history across sessions, powerful globbing (recursive patterns, qualifiers), and extensive customization options. Zsh is POSIX-compatible when needed but extends well beyond POSIX with associative arrays, floating-point math, and advanced parameter expansion.
参数
- -c _string_
- Execute commands from string
- -f
- Don't source startup files
- -i
- Force interactive mode
- -l
- Login shell
- -n
- No execute; check syntax only
- -s
- Read commands from stdin
- -v
- Verbose; print input as read
- -x
- Xtrace; print commands as executed
FAQ
What is the zsh command used for?
zsh (Z Shell) is an extended Bourne shell with many improvements, combining features from bash, ksh, and tcsh. It offers powerful completion, theming, and scripting capabilities. Zsh is highly configurable through ~/.zshrc for interactive settings and ~/.zshenv for all shells. Framework projects like Oh My Zsh and Prezto provide pre-configured themes and plugins. Key features include advanced tab completion (programmable and context-aware), spelling correction, shared history across sessions, powerful globbing (recursive patterns, qualifiers), and extensive customization options. Zsh is POSIX-compatible when needed but extends well beyond POSIX with associative arrays, floating-point math, and advanced parameter expansion.
How do I run a basic zsh example?
Run `zsh` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c _string_ do in zsh?
Execute commands from string