Edit crontab of user where www-data is the user
crontab -u www-data -e
Sync two directories. This overwrites files with the same names
rsync -a /dir1/ /dir2/
Show information about a file or directory
stat file.txt
Show file or directory size
du -sh directory/
Zip up a directory
zip -r zip_filename.zip
Unzip file to current directory
unzip zip_filename.zip
List files and directories in a zip file
zipinfo zip_filename.zip
Search for “whatever” in file.txt
grep -i “whatever” file.txt
Run last command
!!
Run last command as root
sudo !!
Debug SSH connection
ssh -vvvvA user@host
Get information about a site’s SSL certificate
openssl s_client -connect example.com:443
Using UFW, allow from a source to a port
ufw allow from 172.25.0.0/21 to any port 53
Notes
One of the easiest tools to use if you don’t know the syntax of a command is TLDR. On Ubuntu you
can simply install it using apt, apt install tldr. Simply use tldr zip where zip is the
command you wish to know more about.