Step 1: Using any of the following tools, send a GET request
to alias alchemy domain with/without q (default all) query
parameter to download the composite alias file and the finally save this
file at the ~/.alias.sh.
Step 3: After creating the alias file and configuring our system, another
operation that can be performed is appending the alias file using the
>> operator. It is perhaps the reason why this project exists.
# Shell Aliases (debian, git)
alias '$ '=''
alias sudo='sudo '
alias 'cd..'='cd ..'
alias ls='ls -CFG'
alias ll='ls -alFG'
alias la='ls -ACFG'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias vgrep='grep -v grep | grep --color=auto'
alias bc='bc -l'
alias ipi='ipconfig getifaddr en0'
alias ipe='curl ipinfo.io/ip && printf "\n"'
alias cls='clear'
alias dir='ls'
alias pping='prettyping --nolegend'
alias ':q'='exit'
alias sag='sudo apt-get'
alias sai='sudo apt install'
alias sau='sudo apt update'
alias sauu='sudo apt upgrade'
alias sadu='sudo apt dist-upgrade'
alias sar='sudo apt autoremove'
function long_clear() {
len=${1:-10}
for ((i=1; i <= len; i++)) do
printf '\n'
done
}
alias lcls='long_clear'
cat() {
for file in "$@"; do
ext="${file##*.}"
case "$ext" in
json)
if command -v python &> /dev/null && command -v pygmentize &> /dev/null; then
command python -m json.tool "$file" | pygmentize -l json
else
command cat "$file"
fi
;;
yaml|yml)
if command -v pygmentize &> /dev/null; then
command cat "$file" | pygmentize -l yaml
else
command cat "$file"
fi
;;
toml)
if command -v pygmentize &> /dev/null; then
command cat "$file" | pygmentize -l toml
else
command cat "$file"
fi
;;
md)
if command -v glow &> /dev/null; then
command glow "$file"
else
command cat "$file"
fi
;;
*) command cat "$file";;
esac
done
}
alias 'kore_nani?'='if [[ $((KORE_NANI_COUNT+=1)) -ge 6 ]]; then nyancat; KORE_NANI_COUNT=0; fi;'
## Git Aliases
parse_git_branch2() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
alias gbr='git branch'
alias gps='git push'
alias gpl='git pull'
alias gch='git checkout'
alias gco='git commit -m'
alias gca='git commit --amend --no-edit'
alias gs='git status'
alias gsb='git status -sb'
alias ga='git add'
alias gus='git restore --staged'
alias gr='git reset'
alias grs='git reset --soft'
alias grh='git reset --hard'
alias grb='git rebase --autostash'
alias grbm='git rebase $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@") --autostash'
alias gf='git fetch'
alias gd='git diff'
alias gup="git push --set-upstream origin \$(parse_git_branch2)"
alias gw='git whatchanged'
alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
gac() {
## The Idea is to create a commit message from the branch name
## For Example:
## if branch name is `feature/jira-123-this-is-issue-desc`
## then commit would be `[Enhancement JIRA-123] This Is Issue Desc`
# Exit, if there is nothing to commit!
if [[ $(git diff --staged) == "" ]]; then
echo "Nothing to Commit! " && return 1
fi
# Fetch Details
# ----------------
local current_branch
local issue_type
local issue_no
local issue_desc
## `feature/jira-123-this-is-issue-desc`, all in lower case
current_branch=$(git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]')
## `feature`
issue_type=$(echo "$current_branch" | cut -d '/' -f 1)
## `jira-123`
issue_no=$(echo "$current_branch" | cut -d '/' -f 2- | cut -d '-' -f -2)
## `this-is-issue-desc`
issue_desc=$(echo "$current_branch" | cut -d '/' -f 2- | cut -d '-' -f 3- )
# Format Details
# ----------------
## We will use this map to get issue_type out of branch name
declare -A branch_map; branch_map["feature"]="Enhancement";
branch_map["bugfix"]="Patch"; branch_map["version"]="Upgrade";
## `feature` -> `Enhancement`; `random` -> `Random`
issue_type=${branch_map[$issue_type]-${issue_type^}}
## `jira-123` -> `JIRA-123`
issue_no=$(echo "$issue_no" | tr '[:lower:]' '[:upper:]')
## `this-is-issue-desc` -> `This Is Issue Desc`
issue_desc=$(echo "$issue_desc" | sed 's/-/ /g' | awk '{for (i=1; i<=NF; i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')
## `[Enhancement JIRA-123] This Is Issue Desc`
local commit_msg="[$issue_type $issue_no] $issue_desc"
# Commit!
# ----------------
## Along with this message, I have added $@, So that all the
## flags and arguments of `git commit` can be passed in this command.
git commit -m \""$commit_msg"\" "$@"
}
# Python Aliases (py, py(uv), alembic, django, celery)
DEFAULT_VENV_DIR='./venv'
alias actenv='source $DEFAULT_VENV_DIR/bin/activate'
alias py='python'
alias py2='python2'
alias bpy='bpython'
alias ptpy='ptpython'
alias ipy='ipython'
alias jn='jupyter notebook'
alias crtenv='python -m venv $DEFAULT_VENV_DIR'
alias pi='pip install'
alias pir='pip install -r requirements.txt'
alias pirc='pip install -r requirements.txt -c constraints.txt'
alias pui='pip uninstall'
alias pf='pip freeze | sort'
alias pfr='pip freeze | sort > requirements.txt'
alias pyserve="python3 -m http.server"
pyclean () {
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
}
## uv Aliases: overwrite venv and pip aliases, if uv is installed.
if command -v uv &> /dev/null; then
alias upy='uv python'
alias crtenv='uv python venv $DEFAULT_VENV_DIR'
alias pi='uv pip install'
alias pir='uv pip install -r requirements.txt'
alias pirc='uv pip install -r requirements.txt -c constraints.txt'
alias pui='uv pip uninstall'
alias pf='uv pip freeze | sort'
alias pfr='uv pip freeze | sort > requirements.txt'
fi
## Alembic Aliases
alias alex='alembic'
alias alre='alembic revision'
alias alup='alembic upgrade'
alias aldn='alembic downgrade'
## Django Aliases
# ${PWD##*/} returns current working directory.
alias wsgi='gunicorn ${PYPROJ:-${PWD##*/}}.wsgi:application'
alias asgi='daphne ${PYPROJ:-${PWD##*/}}.asgi:application'
alias dj='python manage.py'
alias djr='python manage.py runserver'
alias djr+='python manage.py runserver_plus'
alias djmm='python manage.py makemigrations'
alias djm='python manage.py migrate'
alias djmmm='python manage.py makemigrations && python manage.py migrate'
alias djs='python manage.py shell'
alias djs+='python manage.py shell_plus'
alias djdb='python manage.py dbshell'
alias djdb+='python manage.py dbshell_plus'
alias djcs='python manage.py collectstatic --noinput --clear'
alias djt='python manage.py test'
alias djdd="python manage.py dumpdata"
alias djld="python manage.py loaddata"
## Celery Aliases
alias clb='celery -A ${PYPROJ:-${PWD##*/}} beat -l info'
alias clw='celery -A ${PYPROJ:-${PWD##*/}} worker -l info'
alias clf='celery -A ${PYPROJ:-${PWD##*/}} flower'
# Docker Aliases (docker, compose, swarm)
alias dk='docker'
alias dkpl='docker pull'
alias dkpu='docker push'
alias dkcp='docker cp'
alias dkps='docker ps'
alias dkcls='docker ps'
alias dki='docker images'
alias dkils='docker images ps'
alias dktop='docker stats'
alias dkv='docker volume'
alias dkvls='docker volume ls'
function dkls(){
printf 'Containers:\n\n' && docker ps
printf '\n\nImages:\n\n' && docker images
printf '\n\nVolumes:\n\n' && docker volume ps
}
alias dkr='docker run'
function dkrt(){
docker run -it "$1" "${2:-bash}"
}
function dklc(){
docker ps -lq
}
function dkex(){
docker exec -it "${1:-$(dklc)}" "${2:-bash}"
}
function dka(){
docker attach "${1:-$(dklc)}"
}
function dkin(){
docker inspect "${1:-$(dklc)}"
}
function dkl(){
docker logs "${1:-$(dklc)}"
}
function dklf(){
docker logs -f "${1:-$(dklc)}"
}
alias dks='docker stop -t 1'
alias dksl='dklc | xargs docker stop -t 1' # stop latest container
alias dksa='docker stop -t 1 $(docker ps -q)' # Docker stop all containers
alias dkk='docker kill'
alias dkkl='dklc | xargs docker kill' # kill latest container
alias dkka='docker kill $(docker ps -q)' # kill all containers
alias dkrm='docker rm'
alias dkrm='docker rm'
alias dkrma='docker rm $(docker ps -q -a)' # remove all containers
function dksrm {
docker stop -t 1 "$1"; docker rm "$1"
}
alias dksrml='dklc | xargs dksrm'
function dkkrm {
docker kill "$1"; docker rm "$1"
}
alias dkkrml='dklc | xargs dkkrm'
alias dkrmi='docker rmi'
alias dkrmia='docker rmi $(docker images -q -f dangling=true --no-trunc)' #remove all images
alias dkkrml='dklc | xargs dkkrm'
alias dkrmv='docker volume rm'
alias dkrmva='docker rmi $(docker volume ls -q -f dangling=true)' #remove all images
function dkclean(){
docker rm "$(docker ps -a -q)"
docker rmi "$(docker images -q -f dangling=true)"
docker volume rmi "$(docker volume ls -q -f dangling=true)"
}
alias dkprune='docker system prune --all'
dktags() {
curl -s -S "https://registry.hub.docker.com/v2/repositories/library/${1}/tags/" \
| jq '."results"[]["name"]' \
| sort
}
# Docker Compose Aliases
alias dc='docker compose'
alias dccp='docker compose cp'
alias dcb="docker compose build"
alias dcr="docker compose run"
alias dcup="docker compose up"
alias dcupf="docker compose up --force-recreate"
alias dcdn="docker compose down"
alias dcdna="docker compose down --remove-orphans -v -rmi all"
alias dcpl="docker compose pull"
alias dcdn="docker compose attach"
alias dcps="docker compose ps"
alias dctop="docker compose top"
alias dcex='docker compose exec'
alias dcl='docker compose logs'
# Docker Swarm Aliases
alias ds='docker swarm'
alias dsca='docker swarm ca'
alias dsi='docker swarm init'
alias dstm='docker swarm join-token manager'
alias dstw='docker swarm join-token worker'
alias dsj='docker swarm join'
alias dsl='docker swarm leave'
alias dsl='docker swarm leave --force'
alias dsup='docker swarm update'
alias dsconf='docker config'
alias dsconfls='docker config ls'
alias dsconfcr='docker config create'
alias dsconfin='docker config inspect'
alias dsconfrm='docker config rm'
# Similar K8s, We use cm (config map)
alias dscm='docker config'
alias dscmls='docker config ls'
alias dscmcr='docker config create'
alias dscmin='docker config inspect'
alias dscmrm='docker config rm'
alias dsno='docker node'
alias dsnols='docker node ls'
alias dsnops='docker node ps'
alias dsnoip='docker node inspect'
alias dsnoup='docker node update'
alias dsnopm='docker node promote'
alias dsnodm='docker node demote'
alias dssec='docker secret'
alias dssecls='docker secret ls'
alias dsseccr='docker secret create'
alias dssecin='docker secret inspect'
alias dssecrm='docker secret rm'
alias dssvc='docker service'
alias dssvcls='docker service ls'
alias dssvcps='docker service ps'
alias dssvccr='docker service create'
alias dssvcin='docker service inspect'
alias dssvcl='docker service logs'
alias dssvcrb='docker service rollback'
alias dssvcs='docker service scale'
alias dssvcrm='docker service rm'
alias dssvcup='docker service update'
function dsls(){
printf 'Nodes:\n\n' && docker node ls
printf '\n\nConfigs:\n\n' && docker config ls
printf '\n\nSecrets:\n\n' && docker secret ls
printf '\n\nServices:\n\n' && docker services ls
}
function dsps(){
printf 'Nodes:\n\n' && docker node ps
printf '\n\nServices:\n\n' && docker services ps
}
alias dsl='docker service logs'