💾 Archived View for gem.sdf.org › s.kaplan › cheatsheets › commandline-tools › zsh.md captured on 2024-05-12 at 15:31:49.
⬅️ Previous capture (2023-09-08)
-=-=-=-=-=-=-
# Zsh Cheatsheet ## Basic Commands
ls
cd directory_name
mkdir directory_name
rm -rf directory_name
touch file_name
rm file_name
## Aliases
alias short_name='long_command'
unalias short_name
## Functions
function_name() {
# code
}
function_name
## Variables
variable_name=value
$variable_name
$ENV_VARIABLE_NAME
## Loops
while condition; do
# code
done
for i in {1..5}; do
# code
done
for element in "${array[@]}"; do
# code
done
## Conditionals
if condition; then
# code
fi
if condition; then
# code
else
# code
fi
condition && true_case || false_case
## Resources - [Zsh Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) - [Zsh Wiki](https://zsh.sourceforge.io/Guide/) - [Oh My Zsh](https://ohmyz.sh/)