Skip to content

Instantly share code, notes, and snippets.

@colehocking
Last active December 19, 2019 20:02
Show Gist options
  • Save colehocking/7bae67be18908e395a1d315a9f568bd5 to your computer and use it in GitHub Desktop.
Save colehocking/7bae67be18908e395a1d315a9f568bd5 to your computer and use it in GitHub Desktop.
Some good bash aliases
alias c='clear'
alias f='thunar' #or applicable file manager
alias tlist='tmux list-sessions'
alias sbrc='source ~/.bashrc'
alias s='sudo'
# Fetch the the file permissions in octal numeric form
getchmod() {
stat --format '%a' $1
}
# for linux mint
alias linfo='cat /etc/linuxmint/info'
#Get the size of a file in bytes
bytesize() {
echo "$1 - $(wc -c < $1) bytes"
}
# internal IP
alias myip='hostname -I'
# External IP
alias myextip='curl ifconfig.me'
alias la='ls -a'
alias grep='grep --color=auto
alias shutdown='sudo shutdown -P now'
# Requires pdftotext application
alias pdf='pdftotext'
# Serve the current directory tree @ http://$HOSTNAME:8000/
alias servedir='python -m SimpleHTTPServer'
# Show the filesystem hierarchy
alias hier='man hier'
# Show battery life percentage in the terminal
alias battery='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
# If the switch is Cisco, and discovery mode is on, this will find
# the port of the switch you are on. Very handy.
cswitch() {
sudo tcpdump -nn -vvv -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000' 2>/dev/null | egrep '0x01|0x03'
}
# Echo the dc's currently being used to stdout
alias dnsstat='cat /etc/resolv.conf'
# A pretty grep search in the current working directory that will provide before/after context.
findit() {
grep -irn --color=auto --before-context=5 --after-context=5 "$1" .
}
# Make mc normal; not that weird blue color
alias mc='mc -b'
# check for DNS leaks
alias dnsleak='w3m dnsleaktest.com'
# Check for internet connection
alias amiup='ping archlinux.org'
# Show the URL source of a git repo
alias git_show='git config --get remote.origin.url'
# Get the size of the dir you're in
alias dirsize='du -ach | grep -i total'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment