-
-
Save sasin91/94e038565fac3dc03477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Use tshark to capture HTTP traffic on port 80, filter only GET requests. | |
alias capture_http_get="tshark 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -R 'http.request.method == "GET" || http.request.method == "HEAD"'" | |
#Output time intervals after ping command has finished | |
alias ping="time ping" | |
#make the ls (list directory) content a little prettier | |
alias ls="ls --color=auto" | |
alias ll="ls -lhA --color=auto" | |
#prettify the grep output | |
alias grep="grep --color=auto" | |
alias egrep="egrep --color=auto" | |
alias fgrep="fgrep --color=auto" | |
alias cd..="cd .." | |
alias ..='cd ..' | |
alias ...='cd ../../../' | |
alias ....='cd ../../../../' | |
alias .....='cd ../../../../' | |
#display disk usage. | |
alias df="df -Tha --total" | |
#Display ram/swap usage | |
alias free="free -mt" | |
#shortcut for downloading files using wget | |
alias wget="wget -c" | |
#retrieve my IP address, using ipecho.net | |
alias getMyIp="curl http://ipecho.net/plain; echo" | |
#Output an easily readable output over active ports, using netstat command. | |
alias ports="netstat -tulanp" | |
#Check if GZIP is supported, using Curl | |
alias hasGzip="curl -I --compress" | |
#Get webserver headers using Curl | |
alias getHeaders="curl -I" | |
#create given directory and enter it. | |
mcd () { | |
mkdir -p $1 | |
cd $1 | |
} | |
diff() { | |
if command -v colordiff >/dev/null; then | |
colordiff "$@" | |
else | |
diff "$@" | |
fi | |
} | |
function extract { | |
if [ -z "$1" ]; then | |
# display usage if no parameters given | |
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>" | |
else | |
if [ -f $1 ] ; then | |
# NAME=${1%.*} | |
# mkdir $NAME && cd $NAME | |
case $1 in | |
*.tar.bz2) tar xvjf ../$1 ;; | |
*.tar.gz) tar xvzf ../$1 ;; | |
*.tar.xz) tar xvJf ../$1 ;; | |
*.lzma) unlzma ../$1 ;; | |
*.bz2) bunzip2 ../$1 ;; | |
*.rar) unrar x -ad ../$1 ;; | |
*.gz) gunzip ../$1 ;; | |
*.tar) tar xvf ../$1 ;; | |
*.tbz2) tar xvjf ../$1 ;; | |
*.tgz) tar xvzf ../$1 ;; | |
*.zip) unzip ../$1 ;; | |
*.Z) uncompress ../$1 ;; | |
*.7z) 7z x ../$1 ;; | |
*.xz) unxz ../$1 ;; | |
*.exe) cabextract ../$1 ;; | |
*) echo "extract: '$1' - unknown archive method" ;; | |
esac | |
else | |
echo "$1 - file does not exist" | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment