Skip to main content

Command Palette

Search for a command to run...

20 Linux Commands Every Server Admin Uses Daily

Updated
•4 min read•View as Markdown
20 Linux Commands Every Server Admin Uses Daily
V
VPSPioneer offers web hosting, white-label reseller hosting and cloud VPS to customers across Europe. Here we share practical guides on Linux, server security, self-hosting, WHMCS, DirectAdmin and Plesk. More at vpspioneer.com

You do not need to know Linux to run a website. You need about twenty commands and the habit of reading what they print. These are the ones we type most on a normal day, grouped by what you are trying to do.

Finding your way around

pwd, ls, cd — where am I, what is here, go there.

ls -lah            # long format, hidden files, human sizes
cd -               # back to the previous directory

find — locate files by name, size, age or owner.

find /var/www -name "*.log" -size +100M
find . -mtime -1                   # changed in the last 24 hours
find . -user root -type f          # files root created in the web tree

Reading files and logs

cat, less, tail, head — show a file, page through it, show the end or the start.

tail -f /var/log/nginx/error.log        # follow live
tail -n 200 /var/log/syslog | less      # last 200 lines, paged

grep — search text. The single most useful command on the list.

grep -i "error" /var/log/php-fpm.log
grep -rn "DB_PASSWORD" /var/www/         # recursive, with line numbers
grep -v "200 " access.log | tail         # everything that is not a 200

Resources and what is running

top / htop — live view of CPU, memory and processes. Press M to sort by memory, P by CPU, q to quit.

free -m — memory in megabytes. Look at available, not free; Linux uses spare RAM as cache and gives it back.

df -h and du -sh — disk usage per filesystem, and size of a directory.

df -h
du -sh /var/www/* | sort -h | tail       # biggest sites last

ps — list processes.

ps aux --sort=-%mem | head              # hungriest by memory
ps aux | grep php-fpm | wc -l           # how many PHP workers

ss — what is listening on which port (replaces netstat).

sudo ss -tulpn

Services

systemctl — start, stop, restart, enable, and see status.

sudo systemctl restart nginx
sudo systemctl status mariadb
sudo systemctl enable --now redis

journalctl — logs for anything systemd runs.

sudo journalctl -u nginx -n 100 --no-pager
sudo journalctl -p err -b                # all errors since boot

Moving things

cp, mv, rm, mkdir — copy, move/rename, delete, create directory.

cp -a site/ site-backup-$(date +%F)/    # -a keeps permissions and timestamps
rm -rf cache/*                          # careful: no undo
mkdir -p a/b/c                          # create the whole path

rsync — copy that only transfers changes, local or over SSH.

rsync -avz --delete /var/www/ user@backup:/srv/www/

scp — copy a single file over SSH.

scp backup.sql.gz user@203.0.113.10:/tmp/

tar — archive and compress.

tar -czf site-$(date +%F).tar.gz /var/www/example.com
tar -xzf site-2026-09-15.tar.gz

Permissions and users

chmod, chown — mode and owner. Full guide: Linux file permissions explained.

sudo — run one command as root. sudo -i opens a root shell; sudo -u www-data php artisan … runs as another user.

Network

curl — fetch a URL, see headers, test an API.

curl -I https://example.com               # headers only
curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://example.com

dig — DNS lookups. dig example.com A +short, dig example.com MX.

ping and traceroute / mtr — is it reachable, and where does the path slow down.

Text editing

nano — the editor that does what you expect. Ctrl+O save, Ctrl+X exit. Use vim if you already know it; do not learn it on a production server at 2 a.m.

The habits that matter more than the commands

  • Press Tab to complete file names; you will make fewer typos.

  • history | grep finds the command you ran last month.

  • Before rm -rf, run ls on the same path first.

  • Read the whole error message. The answer is almost always in it.

Every one of these works on any VPSPioneer managed VPS and on shared plans with SSH enabled. If a command's output does not make sense, paste it into a ticket — that is the fastest way we can help.


Originally published at vpspioneer.com. More guides on hosting, Linux and servers: vpspioneer.com/blog.