Shell Script

References

Snippets

#Ubuntu
sudo reboot
sudo poweroff

#Apache
sudo service apache2 restart
sudo service apache2 stop
sudo service apache2 start

#MySQL
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

Networks

List System Process Reference

ps -A
ps -A | grep <keyword>

Kill System Process Reference

kill <PID>
#eg. kill 1234
pkill <keyword>
#eg. kill firefox

List Ports Usage Reference

#MacOS
lsof -i -P -n
lsof -i -P -n | grep LISTEN 

#Ubuntu
netstat -tulpn
netstat -tulpn | grep LISTEN

# Jupyter Notebook with nohup.out
lsof nohup.out
kill <PID>

Running the program on the background

nohup <program> --no-browser &
#nohup jupyter notebook --no-browser &

Mapping to the server port from local machine

ssh -L <local_port>:localhost:<server port> <login id>
# ssh -L 1000:localhost:1111 muh@udel.edu

Time

# Show current system time
timedatectl

# Change to EST
sudo timedatectl set-timezone America/New_York