summaryrefslogblamecommitdiffstats
path: root/bashrc/common/alias.sh
blob: 85e67d2f56d8336c12a03698f86ffcb4642dfea1 (plain) (tree)
1
2
3
4
5


                 

                          











                                     






                                                    








                                          













                                             
         
                                       
                                                     
 


                         


                                     
# command aliases

# ls helpers
eval $(dircolors -b)
alias ls="ls --color=auto"
alias ll="ls -l"
alias la="ls -la"
alias l="ls -lh"

# cd helpers
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."

# make default what should be default
alias sudo="sudo -H"

# some distibutions (e.g. SuSE) has no nano but pico
if ! hash nano > /dev/null 2>&1 ; then
	if hash pico > /dev/null 2>&1 ; then
		alias nano="pico"
	fi
fi

# prettify mount output
mount() {
	if [[ $# -eq 0 ]]; then
		$(which mount) | column -t
	else
		$(which mount) "$@"
	fi
}

# mkdir + chdir
mkcd() {
	mkdir -p $1 && cd $1
}

# create tarball of one directory
mktar() {
	[[ -z "$1" ]] && return 1
	tar cjvf "${1%%/}.tar.bz2" "${1%%/}/"
}

# rar -> unrar
alias rar=unrar

unzip() {
	[[ ! -r "./${1}" ]] && return 1
	mkcd "${1%%.zip}" && /usr/bin/unzip "../${1}"
}

# screen autoresume
alias screen="screen -xR"

# tmux autoresume
hash tmux 2>/dev/null && alias tmux=t