Examples of bash aliases
# OS related
alias tulpe='sudo ss -tulpna'
alias la='ls -la'
alias ll='ls -l'
alias update='sudo apt update'
alias upgrade='sudo apt update && sudo apt upgrade -y'
alias sapti='sudo apt install'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias mnt="mount | grep '^/dev'"
alias dush='find . -mindepth 1 -maxdepth 1 -type d -exec sudo du -sh {} \; | sort -h'
alias hg='history | grep'
alias load='vi ~/.bash_aliases'
alias lsize='ls -ltS'
alias reload='vi ~/.bash_aliases && source ~/.bash_aliases'
History with date and time
# history with date/time
export HISTTIMEFORMAT="%d/%m/%y %H:%M "
IP Management
# IP management
alias myip='curl icanhazip.com'
alias showip='/usr/sbin/ip -4 -br a'
Functions
Create dir and change into it
mkcd(){
mkdir -p -- "$1" && cd -P -- "$1"
}
Exec bash in given container
dbash(){
docker exec -it $1 bash
}
Get git branch for prompt
parse_git_branch(){
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
Prompts
PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\e[31m\h \[\e[01;34m\]\w \[\e[00m\]\e[93m\]\$(parse_git_branch)\[\e[00m\]\n--> "
Set the icon and title bar of 'putty'
Show the git branch in the prompt
Needs funtion from above
\e[93m\]\$(parse_git_branch)\[\e[00m\]