- Published on
What is Zsh?
- Authors
- Name
- hwahyeon
Zsh stands for Z shell and is a type of Unix shell. macOS used Bash as the default shell before version 10.15 Catalina, but starting with the Catalina update, Zsh became the default shell. This change is believed to have been made to avoid potential legal issues related to Bash's use of the GNU GPLv3 license.
Zsh is highly compatible with Bash and does not differ significantly in terms of basic functionality. However, it enhances the user experience with several notable additional features and improvements.
Key Features of Zsh
1. Customization
One of the main reasons to use Zsh is its compatibility with frameworks like oh-my-zsh
, which make it easy to apply themes and plugins. This allows users to customize their terminal interface to look sleek and modern while also adding productivity-boosting features effortlessly.
2. Globbing
Zsh provides more powerful matching rules for searching file names based on patterns. For example, to find .txt
files in a directory, you can use ls *.txt
. In Zsh, you can take it a step further by using patterns like {file1,file2}*.txt
to find all .txt
files starting with either file1
or file2
. This advanced globbing capability makes file searches more flexible and efficient compared to Bash.
3. Enhanced Array and Scripting Capabilities
Zsh offers stronger support for array handling and script writing than Bash. For instance, in Bash, you would use a syntax like for i in "${array[@]}"
to iterate over array elements, whereas in Zsh, you can simply write for i in $array
. Additionally, Zsh makes it easier to slice or manipulate arrays, enabling more efficient implementation of complex tasks.