Reference: Commonly Used Commands & Scripts for Virtual Private Server
System and Package Management
sudo apt update && sudo apt upgrade -y
sudo apt install [package-name]
sudo apt autoremove -y
sudo apt autoclean
Firewall (UFW)
sudo ufw status verbose
sudo ufw allow 'Apache Full'
sudo ufw allow 8384/tcp # Syncthing Web UI
sudo ufw allow 22000/tcp # Syncthing Sync
sudo ufw allow 21027/udp # Syncthing Discovery
sudo ufw reload
sudo ufw delete [rule-number]
File and Directory Operations
ls -l /etc/logrotate.d/
cd /var/www/bookstack
sudo chown -R www-data:www-data /var/www/bookstack
sudo chmod -R 755 /var/www/bookstack
Services and Daemons
sudo systemctl status apache2
sudo systemctl restart apache2
sudo systemctl status fail2ban
sudo systemctl restart fail2ban
sudo systemctl enable syncthing@<username>
sudo systemctl start syncthing@<username>
Crontab and Scheduling
sudo crontab -l
sudo crontab -e
Log Management
sudo tail -f /var/log/fail2ban.log
sudo tail -f /var/log/ufw.log
sudo logrotate --debug /etc/logrotate.d/[filename]
BookStack Backup & Restore
sudo /usr/local/bin/bookstack-backup.sh
ls -lh /opt/bookstack_backups/
Common Scripts I Execute
sudo /usr/local/bin/update-syncthing-ufw.sh
sudo /usr/local/bin/update-fail2ban-ignoreip.sh
sudo /usr/local/bin/bookstack-backup.sh
sudo /usr/local/bin/syncthing-log-summary.sh
sudo /usr/local/bin/fail2ban-syncthing-report.sh
No Comments