Terminal Basics and Zsh Customization on macOS Tahoe
The Terminal provides direct access to the Unix underpinnings of macOS. Since macOS Catalina, the default shell has been Zsh (Z shell), which offers many improvements over the older Bash shell, including better tab completion and theming capabilities.
Basic Navigation
Navigating the file system via the command line relies on a few core commands:
pwd: Print Working Directory. Shows you exactly where you are in the file system.ls: List files.ls -la: List all files (including hidden ones) with details (permissions, size).
cd: Change Directory.cd Desktop: Go to the Desktop folder.cd ..: Go up one folder level.cd ~: Go to your Home folder.
Essential File Operations
touch filename.txt: Create a new, empty file.mkdir foldername: Make a new Directory.cp source destination: Copy a file.mv oldname newname: Move or rename a file.rm filename: Remove (delete) a file. Warning: This does not move files to the Trash; it deletes them permanently.
Customizing Zsh
Zsh is highly customizable. Its configuration lives in a hidden file in your home directory called .zshrc.
Editing .zshrc
- Open the file in a text editor:
nano ~/.zshrc - Add configurations, aliases, or environment variables.
- Alias Example:
alias ll="ls -la"(Now typingllrunsls -la).
- Alias Example:
- Save (
Ctrl+O,Enter) and Exit (Ctrl+X). - Apply changes:
source ~/.zshrc
Oh My Zsh
The most popular way to manage Zsh configuration is Oh My Zsh, a community-driven framework.
1. Installation
Run the following command in your terminal (requires git and curl):
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2. Themes
Oh My Zsh comes with many themes. To change your theme:
- Open
~/.zshrc. - Find the line
ZSH_THEME="robbyrussell". - Change it to another theme, like
ZSH_THEME="agnoster"(requires Powerline fonts) orZSH_THEME="bira".
3. Plugins
Enable plugins to add functionality. Find the plugins=(git) line in ~/.zshrc and update it:
plugins=(git macos z)
- macos: Adds commands like
showfiles(unhide files) andpfd(print path of frontmost Finder window). - z: Tracks your most visited directories, allowing you to jump to them with fuzzy matching (e.g.,
z project).
Related Guides
- Reading Manual Pages with Man on macOS Tahoe
- Launching Apps and Files with Open on macOS Tahoe
- Master Guide to macOS Tahoe