An overview of the commands you'll use every day when managing a VPS. For each one we explain what it does and what its options mean. At the end you'll find a printable cheat sheet.
What you'll need
- A StormHost VPS with Ubuntu 24.04 or Debian 13
- An SSH connection (guide) or the browser console
- About 20 minutes to try things out
How to read a command#
ls -la /var/log| Part | Example | Meaning |
|---|---|---|
| Command | ls | The program that runs (here, listing a folder). |
| Options | -la | Change its behavior. Short ones are written with one dash and can be combined (-l -a = -la), long ones with two (--all). |
| Argument | /var/log | What the command works on (a file, folder, package name). |
Useful keys:
| Key | What it does |
|---|---|
| Tab | Completes the name of a command, file or folder. Pressing it twice lists the options. Saves you typos. |
| Up / Down arrows | Scroll through previously entered commands. |
| Ctrl+C | Interrupts the running command. In a terminal it is not copy. |
| Ctrl+R | Searches the command history by text. |
| Ctrl+L | Clears the screen (same as the clear command). |
sudo: as root (# at the end of the prompt) you can do everything. As a regular user ($ at the end of the prompt), put sudo in front of a command that needs administrator rights, for example sudo apt update. It asks for your user's password. In this guide we write commands for root; as a regular user, add sudo.
Help: almost every command has help via command --help and a manual via man command (scroll with the space bar, quit with q).
Folders and paths#
Linux has no C: and D: drives. Everything starts at the root folder /.
| Folder | What's in it |
|---|---|
/ | The root of the whole system. |
/root | The home folder of the root user. |
/home/jan | The home folder of the user jan. The shortcut for your own home folder is ~. |
/etc | Configuration files for the system and services. |
/var/log | Logs (some logs are only in the journal, see journalctl). |
/var/www | The usual place for websites. |
/tmp | Temporary files, deleted on restart. |
An absolute path starts with / and works from anywhere (/etc/ssh/sshd_config). A relative path starts from the folder you're in (logs/latest.log). . is the current folder, .. the parent folder.
pwd
ls -la
cd /var/log
cd ..
cdpwd– prints which folder you're in right now.ls -la– lists the folder contents:-lin detail (permissions, owner, size, date),-aincluding hidden files (they start with a dot).cd /var/log– goes to the/var/logfolder.cd ..– goes one level up.cd– with no argument, returns to your home folder.
How to read a line from ls -la:
-rw-r--r-- 1 root root 1234 Oct 1 10:00 config.yml| Part | Meaning |
|---|---|
- | Type: - file, d folder, l link. |
rw-r--r-- | Permissions: owner (rw-), group (r--), others (r--). r read, w write, x execute (for a folder, enter). |
root root | Owner and group. |
1234 | Size in bytes (human-readable with the -h option, e.g. 1.2K). |
Oct 1 10:00 | Date of the last change. |
Files#
| Command | What it does |
|---|---|
cat file.txt | Prints the whole file. Handy for short files. |
less file.txt | Views a long file. Arrows and the space bar scroll, /text searches, q quits. |
tail -n 50 file.log | The last 50 lines. With -f it keeps printing new lines (following a log). |
cp source target | Copies a file. Copy a folder with the -r (recursive) option. |
mv source target | Moves or renames a file or folder. |
mkdir -p path/to/folder | Creates a folder; -p also creates missing parent folders. |
rm file | Deletes a file. |
rm -r folder | Deletes a folder including its contents. |
rm deletes for good
Linux has no recycle bin. What you delete with rm is gone. Be especially careful with rm -r, and never run rm -rf with a path you haven't checked twice. One extra space is enough: rm -rf /var/www/ my-site instead of rm -rf /var/www/my-site deletes the whole /var/www folder with all websites. You can restore the whole VPS from a backup in the Backups tab, but you lose the changes made since the backup.
The nano editor#
nano /etc/hostsOpens the file in a simple editor. The controls are listed in the bottom lines; ^ means Ctrl and M- means Alt.
| Keys | What they do |
|---|---|
| Ctrl+O, then Enter | Saves the file. |
| Ctrl+X | Closes the editor. With unsaved changes it asks: Y save, N discard. |
| Ctrl+W | Searches for text. |
| Ctrl+K | Cuts the whole line. |
| Ctrl+U | Pastes the cut line. |
| Alt+U | Undoes the last change. |
Paste text from the clipboard with your terminal's shortcut (Windows Terminal Ctrl+V, PuTTY a right-click, macOS Cmd+V).
Permissions and owner#
chmod 644 soubor.txt
chmod 755 skript.sh
chown jan:jan soubor.txt
chown -R www-data:www-data /var/www/webchmod– changes permissions. The number has three digits: owner, group, others. Each digit is a sum of4(read) +2(write) +1(execute).chown user:group– changes the owner and group.-R– recursively, meaning for everything inside the folder too.
| Number | Permissions | Typical use |
|---|---|---|
644 | owner reads and writes, others only read | Regular files, website configuration |
600 | only the owner reads and writes | Passwords, keys, .env |
755 | owner everything, others read and execute | Folders, executable scripts |
700 | owner only | Private folders (~/.ssh) |
Don't use 777 permissions (everyone can do everything). They won't solve a permission problem; they just open the file to anyone.
Packages (apt)#
| Command | What it does |
|---|---|
apt update | Downloads the current package list. Always run it before installing. |
apt upgrade | Updates installed packages. Installs new dependencies but never removes a package. |
apt full-upgrade | Updates everything, even if some package has to be removed for it (typically with a bigger dependency change). |
apt install htop | Installs a package. Separate multiple packages with a space. |
apt remove htop | Uninstalls a package but keeps its configuration files. |
apt purge htop | Uninstalls a package including its configuration. |
apt autoremove | Removes dependencies nothing needs anymore. |
apt search name | Searches for a package by name and description. |
The -y option (apt install -y htop) automatically confirms the “Do you want to continue?” question.
Services and logs#
Services (web server, database, SSH) are managed by systemd with the systemctl command.
| Command | What it does |
|---|---|
systemctl status nginx | Service status: active (running) is running, failed crashed, plus the last few log lines. Quit with q. |
systemctl restart nginx | Restarts the service. |
systemctl reload nginx | Loads a new configuration without interruption (only some services support it). |
systemctl stop nginx / start nginx | Stops / starts the service. |
systemctl enable nginx | The service starts when the VPS boots. With --now it also starts right away. |
systemctl disable nginx | The service doesn't start at boot. |
systemctl --failed | Lists services that crashed. |
journalctl reads service logs:
journalctl -u nginx -n 50 --no-pager
journalctl -u nginx -f
journalctl -u nginx --since "1 hour ago"-u nginx– only entries of thenginxservice.-n 50– the last 50 lines.--no-pager– print directly, without thelessviewer.-f– keep printing new entries (quit with Ctrl+C).--since "1 hour ago"– entries from the last hour ("2026-10-01 10:00"works too).
Disk, memory and processes#
| Command | What it shows |
|---|---|
df -h | Used and free space on disks. Watch the line with the mount point /. -h = human-readable units. |
du -sh /var/log | How much space a folder takes. -s total, -h human-readable. |
du -xh --max-depth=1 / 2>/dev/null | sort -h | Sizes of the folders in the root, sorted from smallest. For finding what filled up the disk. -x counts only the system disk, 2>/dev/null hides messages about inaccessible files, sort -h sorts by size. |
free -h | RAM and swap. The available column is what matters. |
uptime | How long the VPS has been running and the average load over 1, 5 and 15 minutes. |
htop | A live overview of processes, CPU and memory. The M key sorts by memory, P by CPU, q quits. If it's missing: apt install htop. |
top | A simpler version of htop, always installed. |
ss -tulpn | Ports that programs are listening on. |
The ss -tulpn options: -t TCP, -u UDP, -l only listening ports, -p program name, -n numbers instead of names. The address 0.0.0.0 or [::] means reachable from outside (if the firewall lets it through), 127.0.0.1 only inside the VPS.
Network#
| Command | What it does |
|---|---|
ip a | IP addresses of the network interfaces (ip -br a for a short version). |
ip r | The routing table. The default via … line is the default gateway. |
ping -c 4 1.1.1.1 | Connection test: 4 packets to the server 1.1.1.1. |
curl -I https://example.cz | Downloads only a website's headers. Confirms that the site responds (HTTP/2 200). |
dig example.cz A +short | Looks up a domain's DNS record. If it's missing: apt install bind9-dnsutils. |
Users#
| Command | What it does |
|---|---|
whoami | Which user you're logged in as. |
id jan | The groups of the user jan. |
adduser jan | Creates a user (see Securing a new VPS). |
passwd jan | Changes the password of the user jan (without a name, the current user's password). |
sudo -i | Switches from a regular user to root. |
exit | Logs you out, or ends sudo -i. |
Restart and shutdown#
| Command | What it does |
|---|---|
reboot | Restarts the VPS system. |
poweroff | Shuts down the VPS. You can only turn it back on with the Start button in the Console tab. |
After a RAM or CPU upgrade, reboot isn't enough; use the Restart button in the customer area (see Browser console).
Cheat sheet#
| Task | Command |
|---|---|
| Where am I | pwd |
| What's in the folder | ls -la |
| Go to a folder | cd /path |
| Show a file | cat file / less file |
| Edit a file | nano file |
| Follow a log | tail -f file.log |
| Copy / move | cp a b / mv a b |
| Delete (for good) | rm file / rm -r folder |
| Permissions | chmod 644 file |
| Owner | chown jan:jan file |
| Updates | apt update && apt full-upgrade |
| Install | apt install package |
| Service status | systemctl status service |
| Restart a service | systemctl restart service |
| Service log | journalctl -u service -f |
| Disk space | df -h |
| What takes up space | du -sh /path/* |
| Memory | free -h |
| Processes | htop |
| Open ports | ss -tulpn |
| IP addresses | ip -br a |
| Interrupt a command | Ctrl+C |
Troubleshooting#
command not found#
The program isn't installed, or there's a typo in the name. Ubuntu often tells you which package contains the program (Command 'htop' not found, but can be installed with: apt install htop).
Permission denied#
You don't have the rights. As a regular user, repeat the command with sudo. For a script, the execute permission is missing: chmod +x skript.sh.
No such file or directory#
The path doesn't exist. Check it with the Tab key (it completes only existing names) and check upper and lower case: Linux treats Config.yml and config.yml as different files.
E: Unable to locate package#
Run apt update first. If the error persists, the package has a different name; search with apt search.
E: Could not get lock /var/lib/dpkg/lock-frontend #
Another installation is running in the background (often automatic updates). Wait a few minutes and run the command again.
No space left on device#
The disk is full. Find what takes up the space (du -xh --max-depth=1 / 2>/dev/null | sort -h, then the same in the biggest folder, for example du -xh --max-depth=1 /var 2>/dev/null | sort -h), delete what you don't need (old backups, logs), clean up packages (apt clean) and old journal entries (journalctl --vacuum-size=200M). Or extend the disk.
Summary
- Command = program, options and arguments; Tab completes, Ctrl+C interrupts.
- Files:
ls,cd,cat,less,nano,cp,mv,rm(permanent!). - Packages:
apt update,apt install,apt full-upgrade. - Services:
systemctl status|restart|enable, logs withjournalctl -u service. - Resources:
df -h,du -sh,free -h,htop,ss -tulpn.