Zsh One-liners
List directory on entry
function cd {
builtin cd "$@" && ls
}
Handy way print all contents of the directory when navigating around the filesystem.
Reload
alias reload='exec ${SHELL} -l'
If you change your shell settings on the fly often running reload will just restart the current shell with the new settings.
Safer move + copy
alias mv='mv -iv'
alias cp='cp -iv'
• -i Interactive mode. Prompts the user for confirmation before overwriting a file.
• -v Verbose mode. Displays the details of what is being moved or renamed.
Print path variables
alias path='echo -e ${PATH//:/\\n}'
alias pypath='echo -e ${PYTHONPATH//:/\\n}'
Print the $PATH and $PYTHONPATH variables with newlines.
Zsh dump
alias zshdump='zsh -ixc : 2>&1'
Create a “dump” of information about the current state of your Zsh shell, including aliases, functions, and other configuration details. This will print out the source file for each zsh command run on startup. Useful for debugging zsh configurations, and trying to find which file set specific configurations.
Pipe to clipboard
alias clipboard='pbcopy'
Piping to pbcopy will save the text to the clipboard on macOS, however I can never remember the real name of the command.
Just for fun :)
alias weather='curl wttr.in'
alias mud='nc aardmud.org 23'
alias chess='nc freechess.org 23'
alias starwars='nc towel.blinkenlights.nl 23'