Last active
May 28, 2020 20:44
-
-
Save taxilian/e63fd37212f8f609ae6eabf90d71acaa to your computer and use it in GitHub Desktop.
Handy aliases that I use on all my systems
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
# This makes the dark blue color lighter so you can read it | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
# Mac version | |
alias du1='du -d 1 -h' | |
# Linux version | |
alias du1='du --max-depth=1 -h' | |
# use like `cat file.json | jsonformat` | |
alias jsonformat='python -mjson.tool' | |
# supports resuming partial file downloads | |
alias rscp='rsync --partial --progress --rsh=ssh' | |
# mac version of lsusb | |
alias lsusb='system_profiler SPUSBDataType' | |
# adds a vertical gap in a terminal to enable scrollback | |
alias vgap='printf "\n\n\n\n\n\n\n\n\n\n\n\n\n"' | |
# works on mac and linux, shows the current primary IP | |
alias showip='echo Your IP address is `ifconfig | grep -m 1 broadcast | awk "{print \\$2}"`' | |
# works on mac and linux, shows public IP | |
alias showpubip='echo Your Public IP address is `dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | cut -d '"'"'"'"'"' -f 2`' | |
# works only on mac, shows all interfaces with ip address or "Not Connected" | |
alias showInterfaces="networksetup -listallhardwareports | awk '/Hardware Port:/{s = \"\"; for (i = 3; i < NF; i++) s = s \$i \" \"; s = s \$NF; printf \"%s: \",s; getline; cmd = \"ipconfig getifaddr \"\$2; if ((cmd | getline result) > 0 ) { print result; } else { print \"Not Connected\"}}'" | |
# works only on mac, shows active interface ip addresses | |
alias showLiveInterfaces="networksetup -listallhardwareports | awk '/Hardware Port:/{s = \"\"; for (i = 3; i < NF; i++) s = s \$i \" \"; s = s \$NF; printf \"%s: \",s; getline; cmd = \"ipconfig getifaddr \"\$2; if ((cmd | getline result) > 0 ) { print result; } else { print \"Not Connected\"}}' | grep -v Not" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment