Useful Commands

This is my page of small scripts and little one liners that give a helping hand during my daily use of Linux machines.

The below script runs when I login to my machine and its sole purpose is to open a new Firefox window and load up my social media sites. Te script waits for 10 seconds and moves the newly created window to my 6th virtual desktop window.

firefox --new-window \
--new-tab --url \
--new-tab --url \
--new-tab --url \
--new-tab --url & 

sleep 10 
wmctrl -r 'firefox' -t 5

I use Veracrypt to store certain documents and to keep me from having to memorize a long command or open up the GUI (slow) I use this quick one liner to mount it from a terminal session.

sudo veracrypt --text --pim=0 -k "" --protect-hidden=no ~/.Documents /mnt/docs

This commands lists all the currently listening ports on your device. Very useful when your developing a web application and running different servers on different ports.

sudo netstat -lntup | grep LISTEN

I often forget the exact syntax for creating users in MySQL…

mysql -u root -p -e "GRANT ALL PRIVILEGES ON <database_name>.* TO 'new_user'@'localhost' IDENTIFIED BY 'new_user_password';"
mysql -u root -p -e "FLUSH PRIVILEGES"