Zsh Tutorial: Navigate Files Like a Pro | cd, pwd, ls Commands (Lesson 2)
Video: Zsh Tutorial: Navigate Files Like a Pro | cd, pwd, ls Commands (Lesson 2) by Taught by Celeste AI - AI Coding Coach
Watch full page →Zsh Tutorial: Navigate Files Like a Pro | cd, pwd, ls Commands (Lesson 2)
Mastering navigation in the macOS file system using Zsh is essential for efficient command-line work. This lesson covers how to determine your current directory, move between folders, list directory contents with details, and use handy path shortcuts and tab completion to speed up navigation.
Code
# Show your current directory (Print Working Directory)
pwd
# Change directory to Documents folder inside your home directory
cd ~/Documents
# Move up one directory level (to parent directory)
cd ..
# Go to the previous directory you were in
cd -
# Return to your home directory
cd ~
# List files and folders in the current directory
ls
# List files with detailed info (permissions, size, date)
ls -l
# Show all files including hidden ones (those starting with .)
ls -a
# Combine options: detailed listing with hidden files and human-readable sizes
ls -lah
# Use tab completion to auto-complete directory or file names
# Example: type 'cd Doc' then press Tab to complete 'Documents'
Key Points
pwddisplays the full path of your current working directory, helping you know exactly where you are.cdchanges your directory; use shortcuts like~for home,..for parent, and-for previous directory.lslists directory contents; options like-l,-a, and-hprovide detailed, hidden, and human-readable info.- Path shortcuts (
~,.,..,-,/) save time and simplify navigation commands. - Tab completion helps auto-complete file and folder names, reducing typing and errors, and can be triggered by pressing Tab once or twice.