Short answer: With about twenty commands you can do most everyday server tasks: navigate folders, manage files, check disk and memory, read logs, search files and restart services. Practise them on a test server before using them on a live site.
Moving around and files
| Command | What it does |
|---|---|
| pwd | Show the current folder |
| ls -la | List files, including hidden ones |
| cd /path | Change folder |
| cp a b | Copy a file |
| mv a b | Move or rename |
| rm file | Delete a file (careful) |
| mkdir name | Create a folder |
| nano file | Edit a file |
Checking the server
| Command | What it does |
|---|---|
| df -h | Disk space |
| du -sh * | Size of each item in this folder |
| free -h | Memory use |
| top or htop | Live processes |
| uptime | Load and time since restart |
Logs and searching
| Command | What it does |
|---|---|
| tail -f file.log | Follow a log as it updates |
| grep "error" file.log | Find lines containing a word |
| find . -name "*.php" | Find files by name |
Services and permissions
| Command | What it does |
|---|---|
| sudo systemctl restart nginx | Restart a service |
| sudo systemctl status nginx | Check a service |
| chmod 644 file | Change permissions. See file permissions |
| sudo apt update && sudo apt upgrade | Update packages |
Stay safe
Double-check paths before deleting, and take backups first. Connect securely with SSH keys. See how to use SSH.
Frequently asked questions
Can I use these on shared hosting?
If your plan includes SSH access, many of them work in your home folder.
What does sudo do?
It runs a command with administrator rights. Use it carefully.



