re: 5 Handy Bash Tricks in 2 Minutes VIEW POST


Some of my regular bash commands:

A simple way to monitor network connectivity and latency -- ping a highly-available domain like google.com:

ping google.com | while read pong; do echo "$(date): $pong"; done

I also like to use alias to shorten frequently-used commands and parameters. Here are some examples from my .bashrc:

alias l="ls -aF"
alias ll="ls -laF"
alias c="cd"
alias m="more"
alias e="env | sort"
alias h='history'
alias p="pwd"
alias g="go run"
alias cd..='cd ..'
alias c..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'

Print each PATH entry on a separate line:

alias path='echo -e ${PATH//:/\n}'

Open the current directory in macOS Finder:

alias o="open ."

code of conduct - report abuse