DEV Community

Cover image for ZSH Aliases Collection
Sparkdex
Sparkdex

Posted on • Updated on

ZSH Aliases Collection

Everyone has their own aliases and set them according to their preferences.
Here I've tried to make a big collection and will update it on a regular basis. Aliases related to Docker etc are yet to be added.

Here are the various aliases that I use on a regular basis. Some of them are my own and others are collected from somewhere else.

It's a pretty big collection, some might not have any explanation tho.

1. Installation Related.

#-------------------------------------------------------------
# Aliases for Installation
#-------------------------------------------------------------

alias install="sudo apt-fast install"           #apt-get wrapper for better performance.
alias upgrade='sudo apt-fast upgrade'           #sudo apt-get upgrade
alias update='sudo apt-fast update'             #sudo apt-get update
alias remove="sudo apt remove"  
alias purge="sudo apt purge"
alias autoremove="sudo apt autoremove"
Enter fullscreen mode Exit fullscreen mode

2. Youtube-dl and Music

#-------------------------------------------------------------
# Aliases for youtube-dl and related music apps.
#-------------------------------------------------------------


# Youtube-dl or Music
alias mp3="youtube-dl --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --embed-thumbnail --add-metadata --output '%(autonumber)s-%(title)s.%(ext)s'"          #youtube-dl for single song. Adds Metadata and Thumbnail plus highest quality.
alias playlist="youtube-dl --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --yes-playlist --add-metadata --embed-thumbnail --output '%(autonumber)s-%(title)s.%(ext)s'"  #youtube-dl for playlist. Adds Metadata and Thumbnail plus highest quality.
alias play="playx"                            # Playx utility, can play any song.
alias mc="mcop"                               #MCOP- Terminal based player.

Enter fullscreen mode Exit fullscreen mode

3. Git Related.


#-------------------------------------------------------------
# Aliases for Git.
#-------------------------------------------------------------

alias g='git'
alias amend="git commit --amend --no-edit"      #Commit changes onto previous commit.
alias changelog='gitmoji-changelog'             #Using gitmoji-changelog generator.
alias commit= 'gitmoji -c'                      #Gitmoji commit standard.                         

Enter fullscreen mode Exit fullscreen mode

4. General Ones.


#-------------------------------------------------------------
# Aliases for general stuff.
#-------------------------------------------------------------

alias ls='ls -G'                              # colorize `ls` output
alias zshreload='source ~/.zshrc'             # reload ZSH
alias grep='grep --color=auto'                # colorize `grep` output
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias rm='rm -i'                              # confirm removal
alias cp='cp -i'                              # confirm copy
alias mv='mv -i'                              # confirm move
alias cal='gcal --starting-day=1'             # print simple calendar for current month
alias weather='curl v2.wttr.in'               # print weather for current location (https://github.com/chubin/wttr.in)
Enter fullscreen mode Exit fullscreen mode

5. Npm, Pnpm and Yarn.

#-------------------------------------------------------------
# Aliases for PNPM, NPM and YARN
#-------------------------------------------------------------
alias ni='npm install' 
alias pi='pnpm install'
alias yi='yarn'                               #Same thing as yarn install.
alias rmodule='rm -rf node_modules .yarn'     #removes node_modules folder for npm and pnpm. and .yarn for yarn.
Enter fullscreen mode Exit fullscreen mode

Aliases below are picked and collected from different places.

5. Github CLI

#-------------------------------------------------------------
# Aliases for new GITHUB CLI.
#-------------------------------------------------------------
alias ghh='gh help'
alias ghi='gh issue'
alias ghic='gh issue create'
alias ghil='gh issue list'
alias ghis='gh issue status'
alias ghiv='gh issue view'

alias ghp='gh pr'
alias ghpc='ghp create'
alias ghpck='ghp checkout'
alias ghpl='ghp list'
alias ghps='ghp status'
alias ghpv='ghp view'

alias ghv='gh --version'
Enter fullscreen mode Exit fullscreen mode

6. Randoms


#-------------------------------------------------------------
# Aliases for random stuff.
#-------------------------------------------------------------
alias rimraf='rm -rf'
alias flushdns='sudo killall -HUP mDNSResponder'
alias listen="lsof -P -i -n" #Show which applications are connecting to the network.
alias showport='netstat -tulanp' #Show the active ports.


Enter fullscreen mode Exit fullscreen mode

7. KDE related.

#-------------------------------------------------------------
# Useful in KDE.
#-------------------------------------------------------------


alias kde_restart= 'kquitapp5 plasmashell && kstart plasmashell'
alias plasma_reset= " cd ~/.config && for j in plasma*; do mv -- "$j" "${j%}.bak"" #Changes all Plasma config file and folders name. Restart your system to start anew.
alias latte_reset='killall -9 latte-dock && latte-dock'
Enter fullscreen mode Exit fullscreen mode

Here is my .zshrc file.

Top comments (2)

Collapse
 
moopet profile image
Ben Sinclair

alias cal='gcal --starting-day=1'

I don't know what gcal is, but this is what cal already does, and it's likely already bundled with your system.

alias rimraf='rm -rf'

Why do you have an alias like this? What problem does it solve?

Collapse
 
sparkedx profile image
Sparkdex

That's not something I usually use. As I've mentioned on the post, I picked the last 2/3 blocks from the internet.