Last edit: 7 Nov 2020

General

#Display OS
uname -a

# Fetches the list of available updates
sudo apt update

# Installs some updates; does not remove packages
sudo apt upgrade

# Installs updates; may also remove some packages, if needed
sudo apt full-upgrade

# Removes any old packages that are no longer needed
sudo apt autoremove

# Distribution upgrade
sudo apt dist-upgrade

# OS upgrade
sudo do-release-upgrade

#Delete GZip files older than 14 days
find *.gz -mtime +14 -exec rm {} \;

Nginx

/etc/nginx/sites-available

#start nginx
service nginx start

#stop nginx
service nginx stop

#restart nginx
service nginx restart

#reload nginx
service nginx reload

#check nginx config
nginx -t

#check nginx status
service nginx status

MySQL

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

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

#restart
sudo /etc/init.d/mysql restart

#mySQL dump
mysqldump --opt -uUSERNAME -pPASSWORD -h HOSTNAME DATABASE_NAME FILENAME.sql

#mySQL version
mysql -V

# Change user password
mysql -u root -p
uninstall plugin validate_password;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassword';
FLUSH PRIVILEGES;

Let’s Encrypt / Certbot

# Register SSL certificate
sudo certbot --nginx -d domain.com -d www.domain.com