This is an example of what my zshell configuration file(.zshrc) looks like:
if [ $ITERM_SESSION_ID ]; then
precmd() {
echo -ne "\033]0;${PWD}\007"
}
fi
# prompt stuff
PROMPT='%B%F{51}%n@MacOS%f%b-%F{green}[%1d]%F{cyan}:~$%F{reset_color} '
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# colorize the ls output
alias ls='ls --color=auto'
## Use a long listing format ##
alias ll='ls -la'
# Change directoroy
alias down='cd ~/Downloads/ && ls -alh'
alias desk='cd ~/Desktop/ && ls -alh'
alias scripts='cd ~/scripts/ && ls -alh'
alias blog='cd ~/omega-blog/templates/ && ls -alh'
alias dl="cd ~/Downloads/"
alias ~="cd ~"
alias ..='cd ..'
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
mcd () { mkdir -pv "$1" && cd "$1"; } # mcd Makes new Dir and jumps inside
trash () { command mv "$@" ~/.Trash ; } # trash Moves a file to the MacOS trash
# various
alias o='open -a Finder ./' # f Opens current directory in MacOS Finder
alias c='clear' # c Clear terminal display
alias h='history' # h show history
alias g='grep --color=auto' # g Short for grep
alias ch='history -c' # hc Clear history
alias p='ping 8.8.8.8' # p Ping googles public dns
alias l='ls -alh' # l list files and directories in human readable format
alias show="ps aux | grep -v grep | grep -i -e VSZ -e" # searches our process for an argument we'll pass:
alias icloud='cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/'
# various
alias rmd='rm -rf'
alias less='less -FSRXc' # Preferred 'less' implementation
alias chrome="open -a /Applications/Google\ Chrome.app/ --args --incognito;"
alias copy="pbcopy;"
# various
alias smg='networksetup -connectpppoeservice SMG-VPN'
alias qsmg='networksetup -disconnectpppoeservice SMG-VPN'
# listing usb devices that are plugged in
alias listusbnames="ioreg -p IOUSB -w0 | sed 's/[^o]*o //; s/@.*$//' | grep -v '^Root.*'"
alias lsusb='system_profiler SPUSBDataType && listusbnames'
alias lsports="networksetup -listallhardwareports"
# serial ports
alias serial='ls -al /dev/{tty,cu}.*'
# Listing network information
alias mac="ifconfig en0 | awk '/ether/{print \$2}'"
alias en0='ipconfig getifaddr en0'
#alias listinternalip="ifconfig | grep \"inet \" | grep -Fv 127.0.0.1 | awk '{print \$2}' "
alias iip="ifconfig | grep broadcast | awk '{print \$2}'"
alias ip="ifconfig en0 | grep 'inet ' | awk '{print \$2}'"
alias external='curl ipecho.net/plain; echo'
alias n="`ip | awk -F'.' '{print \"nmap -v -sn \" \$1 \".\" \$2 \".\" \$3 \".0/24\"}'`"
alias pis="arp -an | grep b8"
alias a="arp -an | grep -v incomplete"
# Turn wifi interface on/off
alias wifion='networksetup -setairportpower en0 on'
alias wifioff='networksetup -setairportpower en0 off'
alias resetwifi='wifioff && wifion'
alias wifi='resetwifi'
# cool tools
alias ffs="sudo !!"
# make executable
alias cx='chmod +x'
# Flush DNS cache
alias ffs='sudo !!'
# json formatter
alias json='python -m json.tool'
# sudo
alias sudo='sudo '
alias path='echo -e ${PATH//:/\\n}'
# grep
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
# calculator
alias bc='bc -l'
alias edit='vim'
alias df='df -h'
alias hg='history |grep'
alias c='clear'
alias h='history'
alias z='vim ~/.zshrc'
alias e='exit'
alias search='grep'
alias zr='source ~/.zshrc'
alias d='cd ~/Desktop/ && ls -al'
alias vlc='/Applications/VLC.app/Contents/MacOS/VLC'
alias external='curl ipecho.net/plain; echo'
PROMPT=$(echo $PROMPT | sed 's/(base) //')
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" || true
Last Updated: April 24, 2022