Skip to content

Instantly share code, notes, and snippets.

@Hrissimir
Last active April 25, 2020 00:21
Show Gist options
  • Save Hrissimir/8945a5cc345742273c146ed86e0574a4 to your computer and use it in GitHub Desktop.
Save Hrissimir/8945a5cc345742273c146ed86e0574a4 to your computer and use it in GitHub Desktop.
Collection of useful bash aliases. (put in ~/.bash_aliases
# simplified update
alias update='sudo apt update && sudo apt upgrade'
# properly call autoremove
alias autoremove='sudo apt-get autoremove --purge'
# view nework stats
alias view-running-services='sudo systemctl list-units --type=service --state=running'
alias view-network-connections='sudo netstat -ltup && sudo netstat -tup'
alias view-network-sockets='sudo ss -ltupn && sudo ss -tupn'
# list mounted drives targets and stats
alias df="df -Tha --total"
# view memory stats in MB format
alias free="free -mt"
# view process stats in tree format
alias ps="ps auxf"
# alias for common typo
alias cd..="cd .."
# view cwd contents
alias ls="ls -lhFA"
# create the folder, it's parent dirs and print every created folder's path
# helps notice typos when creating dirs
alias mkdir="mkdir -pv"
# continue download in case of problems
alias wget="wget -c"
# show real IP
alias myip="curl http://ipecho.net/plain; echo"
# resize all of the PNG images in the current directory, only if they are wider than 690px.
# need to 'sudo apt-get install imagemagick' to have it working
alias webify="mogrify -resize 690\> *.png"
# view history of specific command e.g. 'histg sudo'
alias histg="history | grep"
# view most commonly used commands (alias not working, just copy-paste to see the output)
# alias top-commands="history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment