Essential Linux Commands Every VPS Owner Should Know

Back to Knowledgebase
VPS 3 min read 2 views Updated Jun 2026

You do not need to memorize hundreds of Linux commands to run a VPS. You need about twenty, used constantly. Here are the ones that cover almost everything, grouped by what you are trying to do, with real examples.

Getting around

pwd            # where am I
ls -lah        # list files, including hidden, with sizes
cd /var/www    # change directory
cd ~           # go to your home directory

Looking at files

cat file.txt           # print a whole file
less file.txt          # scroll through a big file (q to quit)
tail -f app.log        # watch a log live as it updates
grep "error" app.log   # find lines containing "error"

tail -f is one of the most useful commands you will ever run: it shows a log updating in real time while you reproduce a problem.

Editing files

nano config.conf       # simple editor (Ctrl+O save, Ctrl+X exit)

nano is the friendliest editor. vim is more powerful but has a learning curve, so nano is enough for day-to-day edits.

Managing services

Modern Linux uses systemctl:

sudo systemctl status nginx     # is it running?
sudo systemctl restart nginx    # restart it
sudo systemctl enable nginx     # start automatically on boot
journalctl -u nginx --no-pager  # see its logs

Checking resources

htop          # live CPU, RAM and processes (install if missing)
df -h         # disk space
free -h       # memory
du -sh *      # size of each item in the current folder

More on this in How to monitor a Linux VPS.

Files and permissions

cp a.txt b.txt          # copy
mv a.txt /tmp/          # move or rename
rm file.txt             # delete (careful, no recycle bin)
mkdir newdir            # make a directory
chmod 644 file.txt      # set permissions
chown user:group file   # change owner

rm -rf deletes a folder and everything in it with no confirmation and no undo. Double-check the path every time, especially with sudo.

Updating the system

sudo apt update && sudo apt upgrade -y    # Debian / Ubuntu
sudo dnf upgrade -y                        # Rocky / Alma / Fedora

Staying safe

  • Avoid running everything as root; use a normal user with sudo. See How to secure a Linux VPS.
  • Read a command before you paste it, especially anything with rm, sudo or >.

FAQ

How do I see what is running and stop it?

systemctl status <service> shows state and recent logs, and systemctl restart <service> restarts it. For processes, htop lists them and lets you kill one.

How do I edit a config file over SSH?

nano filename opens a simple editor. Make your change, then Ctrl+O to save and Ctrl+X to exit.

What is the most dangerous command to watch for?

rm -rf, especially with sudo or a wrong path. It deletes recursively with no undo, so always check the path first.

New to SSH itself? Start with Connecting to your Linux VPS over SSH.

Was this guide helpful? Our engineers are here 24/7 if you get stuck.