ZSH
Useful ZSH Commands
NOTE: The following commands are largely the same as BASH commands, since they're both UNIX-based shells.
Basic Commands
Change the Current Directory
cd <DIR_NAME>List Directory Contents
lsMove or Rename Directories
mv <SOURCE> <DESTINATION>Remove Files Directories
rm <FILE_OR_DIR_NAME>Set an Environment Variable
export VARIABLE_NAME=<SOME_VALUE>Display an Environment Variable
Open a Directory in Finder (Mac)
Display an Entire File
Display the First N Lines of a File
Fist 10 Lines:
First 5 Lines:
Show Command History
Clear Terminal History
Ensure only one terminal window is open.
Run the command below:
Close the terminal window.
Quit the terminal app by right-clicking the app icon and selecting “Quit”.
Open a terminal window.
Run the command below to ensure your
.zsh_historyis empty.
Clear Clipboard Content
List Local IP Address
The following command lists all local, non-loopback IPv4 addresses. Each IP address corresponds to a different network interface or network configuration on your machine.
List Public IP Address
SSH
Access a remote machine via SSH.
Exit SSH Session.
In case your shell does not display user@hostname, the following are commands to check this information.
Check the current user's username:
Check the current machine's hostname:
Last updated
Was this helpful?