When I start working all the machines in my office use Windows. That's the moment when I start missing the alias ability that I learned at the university where I used to have Linux on my laptop.
Happily now, ZSH (or bash) can be used on Linux, macOS, and Windows (with WSL).
In addition to all the aliases that can be activated with ZSH plugins, I've defined a lot more that I miss. Hope also can be useful for you.
General
alias c="clear"
alias x="exit" # close terminal
alias e="code -n ~/.zshrc" # edit source
alias r="source ~/.zshrc" # reload source
alias t="htop"
alias d="ncdu --color dark" # +path
History
alias h="history -10" # last 10 history commands
alias hc="history -c" # clear history
alias hg="history | grep " # +command
Alias
alias ag="alias | grep " # +command
Git
⚠ Use this alias with extra caution, you may lose all your changes.
alias guc="git reset --hard HEAD" # undo changes and preserve untracked files
alias gcc="git clean -f -d -x" # clean ALL changes and remove untracked files
I'm not set up the global user and mail on git because I work on different projects. So I have an alias with the most used user.
alias gcu="git config user.name \"equiman\" && git config user.email \"equiman@users.noreply.github.com\""
npm
alias rnm="rm -rf node_modules"
alias rbn="rm -rf build node_modules"
alias rap="rm -rf build node_modules package-lock.json && npm i"
alias npk="npx npkill" #clean unused node_modules
alias nlg="npm list -g --depth 0" #list global packages installed
alias ni="npm i"
alias nise="npm i -S -E " # +package@version
alias nide="npm i -D -E " # +package@version
alias nrb="npm run build"
alias nrbd="npm run build:dev"
alias nrs="npm run start"
alias nrsd="npm run start:dev"
alias nrt="npm run test"
alias np="npm run build && npm publish"
alias nu="npm unpublish " # +package@version
Serverless
alias sd="sls deploy"
alias sdf="sls deploy -f " # +function_name
That’s All Folks!
Happy Coding 🖖
Discussion (1)
Cheers! Thanks for the quick aliases.