A Few Handy Bash Shell Aliases

Reload bash_profile

Apply any changes made to ~/.bash_profile with reload: alias reload='source ~/.bash_profile'

Network Connections

List all network connections with nets: alias nets='lsof -i'

Internet Speed test

Speed test using a 100Mbyte file from OVH Hosting:

alias speedtest='curl -o /dev/null http://ovh.net/files/100Mio.dat'

WAN IP Address

Show WAN IP address with myip: alias myip='curl ifconfig.co'

Web Server Banner

A curl function to grab web server banner information with headers followed by a URL:

headers () { /usr/bin/curl -X GET -I -L -k -A 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36' [email protected] ; }

Website HTML Source

A curl function to view a web page’s html source with view-source followed by a URL:

view-source () { /usr/bin/curl -L -k -A 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0' [email protected] ; }

File Header

View the first few bytes of any file with filehead followed by a filename:

filehead () { /usr/bin/xxd -u -g 1 [email protected] | /usr/bin/head ;}

List and Directory

alias cp='cp -iv'
alias mv='mv -iv'
alias mkdir='mkdir -pv'
alias ll='ls -FGlAhp'
alias less='less -FSRXc'
alias CD='cd'
alias cd..='cd ../'
alias ..='cd ../'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias ~='cd ~'
alias c='clear'

Combined

Just copy and paste within your ~/.bash_profile or ~/.bashrc and run source.

# Reload
alias reload='source ~/.bash_profile'

# Network
alias nets='lsof -i'
alias myip='curl ifconfig.co'
alias speedtest='curl -o /dev/null http://ovh.net/files/100Mio.dat'

# Server Headers
headers () { /usr/bin/curl -X GET -I -L -k -A 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36' [email protected] ; }

# View Page Source
view-source () { /usr/bin/curl -L -k -A 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0' [email protected] ; }

# File Header
filehead () { /usr/bin/xxd -u -g 1 [email protected] | /usr/bin/head ;}

# Common
alias cp='cp -iv'
alias mv='mv -iv'
alias mkdir='mkdir -pv'
alias ll='ls -FGlAhp'
alias less='less -FSRXc'
alias CD='cd'
alias cd..='cd ../'
alias ..='cd ../'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias ~='cd ~'
alias c='clear'

Recent Posts

Intercept HTTPS Traffic over Wi-Fi using mitmproxy
Live Memory Acquisition on Linux Systems
How to build a Debian MIPS image on QEMU