Skip to content

Instantly share code, notes, and snippets.

@SpaceK33z
Last active August 29, 2015 14:01
Show Gist options
  • Save SpaceK33z/d9a9817b5557cbbbaa25 to your computer and use it in GitHub Desktop.
Save SpaceK33z/d9a9817b5557cbbbaa25 to your computer and use it in GitHub Desktop.
bash_aliases
# 'easy extract'
extract () {
if [ -f "$1" ] ; then
case $1 in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar e "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
function syslog() {
tail -f /var/log/system.log
}
# checks port number to see what service is attached
function port2service() {
lsof -i -P | grep "$1"
}
alias ls='ls -F --color=always'
alias ll='ls -l'
alias cp='cp -iv'
alias rm='rm -i'
alias mv='mv -iv'
alias grep='grep --color=auto -in'
# get rid of command not found
alias cd..='cd ..'
# a quick way to get out of current directory
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
# show hidden files only
alias ls.='ls -d .* --color=auto'
# show extra options
alias dir='ls -alv'
# go to directory and execute 'ls'
function cdl() {
if [ "$*" = "" ]
then
cd
else
cd "$*";
fi
dir;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment