Skip to content

Instantly share code, notes, and snippets.

@Strae
Last active September 28, 2017 15:14
Show Gist options
  • Save Strae/82a249c401f395982f74d917675aca7a to your computer and use it in GitHub Desktop.
Save Strae/82a249c401f395982f74d917675aca7a to your computer and use it in GitHub Desktop.
Bash aliases tools
# best-alias-EVER
alias Grep="grep"
# show file/folders permissions on octal (e.g. 777) mode.
alias lso="ls -ahlG | awk '{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\" %0o \",k);print}'"
# just shorthand.
alias nhost="sudo nano /etc/hosts"
# notify that something just happended.
# usefull for commands that require long time - e.g. mysqldump -u XXXXXXX && alert
alias alert="notify-send 'SOMETHING HAPPENED!' -u critical -i /home/dp/.icons/Numix-Circle/scalable/apps/popcorntime.svg"
# keep a debian machine updated. tbh, dunno if really usefull.
alias nukem="sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean && sudo sync"
# start LAMP (nginx, php, mysql)
alias lamp="sudo systemctl start nginx && sudo systemctl start php5-fpm && sudo systemctl start mysql && notify-send 'LAMP STARTED!' -u critical -i /home/dp/.icons/Numix-Circle/scalable/apps/popcorntime.svg"
# restart LAMP (nginx, php, mysql)
alias lamp-restart="sudo systemctl restart nginx && sudo systemctl restart php5-fpm && sudo systemctl restart mysql && sudo sync && notify-send 'LAMP RESTART!' -u critical -i /home/dp/.icons/Numix-Circle/scalable/apps/php.svg"
# stop LAMP (nginx, php, mysql)
alias lamp-stop="sudo systemctl stop nginx && sudo systemctl stop php5-fpm && sudo systemctl stop mysql && notify-send -u critical 'LAMP KILLED.' -i /home/dp/.icons/Numix-Circle/scalable/apps/polly.svg"
# remote query
alias remote_sql="CONNECTION SSH \"mysql -u USER -pPASS DBNAME < /path/to/query.sql\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment