Skip to content

Instantly share code, notes, and snippets.

@ricsiga
Last active February 26, 2018 15:50
Show Gist options
  • Save ricsiga/2d71870b122c912fe417e14be6e837b8 to your computer and use it in GitHub Desktop.
Save ricsiga/2d71870b122c912fe417e14be6e837b8 to your computer and use it in GitHub Desktop.
bash alias example
alias downloadtime='curl -s -w "%{time_total}\n" -o /dev/null $1'
alias pgoogle='ping google.com'
alias pindex='ping index.hu'
alias pdefroute='ping $(netstat -rn | grep "^0.0.0.0" | tr -s [:space:] | cut -f 2 -d " ")'
alias ifconfig-ext='host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has addres"'
alias mkdirdatetime='mkdir $(date +%Y%m%d-%H%M)'
alias showwifichannles='sudo iwlist wlp4s0 scan | grep Frequency | sort | uniq -c | sort -n'
sssh (){
if [ -n "$2" ]; then
ssh -t "$1" -i "$2" 'tmux attach || tmux new';
else
ssh -t "$1" 'tmux attach || tmux new';
fi
}
pwgen (){
if [ -n "$1" ]; then
makepasswd --count=10 --chars=$1
else
makepasswd --count=10 --chars=12
fi
}
ubi (){
if [ -n "$1" ]; then
docker run -ti ubuntu:xenial bash
else
docker run --rm -ti ubuntu:xenial bash
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment