Linux Commands Every VPS User Must Know in 2026
The complete guide to linux commands for VPS users. Learn 50 essential terminal commands for file management, networking, security, and server administration with real examples.
Thomas van Herk
Infrastructure Engineer
You just bought a Linux VPS. You connect via SSH for the first time and you are staring at a blinking cursor on a black screen. No desktop. No icons. No start menu. Just a terminal waiting for you to type something.
This is where most people freeze. They are used to clicking around a graphical interface, and suddenly they need to manage an entire server by typing commands. The good news is that you do not need to memorize hundreds of linux commands to run a VPS effectively. About 40 to 50 commands cover 95 percent of everything you will ever do on a Linux server.
This guide covers every linux command you need as a VPS user, organized by what you are actually trying to do. No filler. No commands you will never use. Just the ones that matter for managing a real server.
The first thing you need to do on any Linux server is move around the file system and understand what is where. These basic linux commands are the foundation of everything else.
This tells you where you are right now in the file system. When you first connect via SSH, you land in your home directory, usually /root for the root user or /home/username for regular users.
pwd
/rootUse this whenever you are lost. It happens more often than people admit, especially when you are jumping between directories.
The command you will type more than any other. It shows you what is in the current directory.
ls
ls -la
ls -lh /var/logThe plain ls shows file and folder names. Add -la to see permissions, ownership, file sizes, and hidden files. Add -lh to get human-readable file sizes (KB, MB, GB instead of raw bytes). You will almost always want ls -la over plain ls.
Move between directories. This is how you navigate the file system.
cd /var/log
cd ~
cd ..
cd -cd /var/log takes you to the log directory. cd ~ takes you home. cd .. goes up one level. cd - takes you back to wherever you were before. That last one is surprisingly useful when you are bouncing between two directories.
Create new folders.
mkdir backups
mkdir -p /var/www/mysite/publicThe -p flag creates parent directories if they do not exist. Without it, mkdir fails if the parent path is missing. Always use -p when creating nested directory structures.
cp file.txt backup.txt
cp -r /var/www/mysite /var/www/mysite-backupCopy a file or, with -r, copy an entire directory recursively. Always make a backup copy before editing important config files. You will thank yourself later.
mv oldname.txt newname.txt
mv /tmp/upload.zip /var/www/mysite/mv does double duty. It renames files when the source and destination are in the same directory, and moves files when they are in different directories.
rm file.txt
rm -rf /var/www/old-siteDelete files and directories. The -r flag removes directories recursively, and -f forces deletion without confirmation prompts. Be extremely careful with rm -rf, especially as root. There is no recycle bin on a Linux server. Once it is gone, it is gone.
You will spend a lot of time reading log files and editing configuration files on a Linux VPS. These linux terminal commands handle both.
cat /etc/hostname
cat /var/log/auth.logDumps the entire file to your terminal. Good for small files. Terrible for large log files because it floods your screen with thousands of lines.
less /var/log/syslogOpens the file in a scrollable viewer. Press space to go forward one page, b to go back, / to search, and q to quit. This is what you should use for log files instead of cat.
head -n 20 /var/log/nginx/access.log
tail -n 50 /var/log/nginx/error.log
tail -f /var/log/sysloghead shows the first N lines. tail shows the last N lines. The real power move is tail -f, which follows the file in real time. Use it to watch logs as they are being written. When you are debugging a web server issue, tail -f on the error log while you reload the page is the fastest way to find the problem.
nano /etc/nginx/nginx.confnano is the beginner-friendly text editor. It shows keyboard shortcuts at the bottom of the screen. Ctrl+O saves, Ctrl+X exits. It is not as powerful as vim, but it gets the job done and you do not need to memorize cryptic key combinations.
vim /etc/nginx/nginx.confvim is the editor that experienced Linux users swear by and beginners swear at. It has two modes: command mode and insert mode. Press i to enter insert mode (where you can actually type), press Esc to go back to command mode, then type :wq to save and quit or :q! to quit without saving. The learning curve is steep but the efficiency gains are real once you get used to it.
Knowing what your server is doing right now is critical for VPS management. These commands tell you about CPU usage, memory, disk space, and running processes.
top
htoptop comes pre-installed on every Linux system and shows running processes sorted by CPU usage. htop is the prettier, more interactive version that you need to install separately (apt install htop on Ubuntu/Debian). Both show CPU usage, memory usage, load average, and individual process details. Press q to quit.
When your VPS feels slow, htop is the first command to run. It immediately shows you whether CPU, RAM, or a specific process is the bottleneck.
df -hShows how much disk space is used and available on each mounted filesystem. The -h flag makes the output human-readable. Run this regularly. Running out of disk space is one of the most common reasons Linux servers crash, and it is completely preventable.
du -sh /var/log
du -sh /var/www/*Shows how much space a directory or its contents are using. When df tells you the disk is full, du helps you find what is eating all the space. The -s flag gives a summary instead of listing every single file, and -h makes it human-readable.
free -hShows total, used, and available RAM. On a VPS, memory is usually your most constrained resource. If the available column is near zero, your server is running out of memory and will start using swap (disk-based virtual memory), which is dramatically slower.
uptimeShows how long since the last reboot and the system load averages for the past 1, 5, and 15 minutes. Load average numbers higher than your CPU core count mean the server is overloaded. A 2-core VPS with a load average of 4.0 is struggling.
uname -aShows the kernel version, architecture, and hostname. Useful when you need to know whether you are running a 64-bit system, which kernel version is installed, or what the hostname is set to.
Running everything as root is convenient but dangerous. These linux commands help you manage users and file permissions properly.
adduser deployCreates a new user account with a home directory. On a VPS, you should create a non-root user for daily tasks and only use root when you need to install software or change system configuration.
usermod -aG sudo deployAdds the user to the sudo group, which lets them run commands as root by prefixing them with sudo. The -aG flag means append to group without removing existing group memberships.
chmod 755 /var/www/mysite
chmod 644 /var/www/mysite/index.html
chmod +x script.shControls who can read, write, and execute files. 755 means the owner can read, write, and execute, while everyone else can only read and execute. 644 means the owner can read and write, everyone else can only read. These two permission sets cover most use cases on a web server.
chown www-data:www-data /var/www/mysite -RChanges who owns a file or directory. The -R flag applies it recursively. Web server files usually need to be owned by the www-data user (on Ubuntu/Debian) so that Nginx or Apache can read them.
Your VPS lives on the internet. These linux command line tools help you troubleshoot network issues, check connectivity, and manage connections.
ping google.com
ping -c 4 8.8.8.8Sends packets to a host and measures the response time. Use it to check if your server has internet access or to measure latency to a specific destination. The -c flag limits the number of pings instead of running forever.
curl https://example.com
curl -I https://blastvps.com
curl -o file.zip https://example.com/file.zipcurl is the Swiss Army knife of HTTP. Use it to test if a website is responding, check HTTP headers with -I, or download files with -o. When your web server is not working, curl from the server itself tells you whether the problem is the server or the network path to it.
wget https://example.com/file.tar.gzDownloads files from the internet. Simpler than curl for straightforward downloads. Supports resuming interrupted downloads with -c, which is useful for large files over unreliable connections.
ss -tlnpShows which ports are open and which processes are listening on them. The flags mean: -t for TCP, -l for listening, -n for numeric (do not resolve hostnames), -p for process names. This replaced the older netstat command. When you need to check if Nginx is actually listening on port 80, ss -tlnp gives you the answer instantly.
ip addr show
ip route showShows your server's IP addresses and routing table. ip addr show tells you what IP addresses are assigned to your network interfaces. ip route show tells you the default gateway and routing rules.
If you are setting up a web server on your VPS, our guide on Nginx vs Apache covers which web server to choose and how to configure it.
Installing and updating software on Linux is done through package managers. The commands differ depending on your distribution.
apt update
apt upgrade
apt install nginx
apt remove nginx
apt autoremoveapt update refreshes the package list (always run this first). apt upgrade installs available updates for all packages. apt install adds new software. apt remove uninstalls it. apt autoremove cleans up packages that were installed as dependencies but are no longer needed.
dnf update
dnf install nginx
dnf remove nginxdnf is the package manager for Red Hat-based distributions. The commands are similar to apt but the package names sometimes differ. dnf replaced the older yum command.
Whichever distribution you use, run updates regularly. Unpatched software is the number one way servers get compromised.
Not sure which Linux distribution to use? Most of our Linux VPS plans support Ubuntu, Debian, CentOS, Rocky Linux, and AlmaLinux. Ubuntu is the most popular choice for beginners.
Sometimes processes hang, consume too much resources, or need to be restarted. These linux server commands handle that.
ps aux
ps aux | grep nginxps aux shows all running processes with their CPU and memory usage. Pipe it through grep to find a specific process. This is how you check if a service is running when systemctl is not giving you the answer you expect.
kill 1234
kill -9 1234
killall nginxkill sends a signal to a process by its PID (process ID). Plain kill sends SIGTERM, which asks the process to shut down gracefully. kill -9 sends SIGKILL, which forces immediate termination. Use -9 only when the process is not responding to regular kill. killall stops all processes with a given name.
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl status nginx
systemctl enable nginxsystemctl is how you manage services on modern Linux systems. start, stop, and restart do what they say. status shows whether the service is running and recent log output. enable makes the service start automatically on boot. This is the command you will use most for managing web servers, databases, and other services on your VPS.
Finding specific files or specific text within files is something you do constantly on a Linux server.
grep 'error' /var/log/nginx/error.log
grep -r 'database' /etc/
grep -i 'warning' /var/log/sysloggrep searches for text patterns in files. The -r flag searches recursively through directories. The -i flag makes the search case-insensitive. When something breaks, grep through the log files for error messages. It is faster than scrolling through thousands of lines manually.
find / -name 'nginx.conf'
find /var/log -name '*.log' -mtime -7
find /tmp -size +100Mfind searches for files by name, modification time, size, and other criteria. The first example finds a file by name anywhere on the system. The second finds log files modified in the last 7 days. The third finds files larger than 100 MB in /tmp. When you need to clean up disk space, find with the -size flag is your best friend.
cat /var/log/auth.log | grep 'Failed' | wc -l
ps aux | sort -k3 -rn | head -10The pipe character | sends the output of one command as input to another. This is one of the most powerful concepts in the linux command line. The first example counts how many failed login attempts are in the auth log. The second shows the top 10 processes by CPU usage. You can chain as many commands together as you need.
Moving files around, creating backups, and extracting downloaded software all involve compression.
tar -czf backup.tar.gz /var/www/mysite
tar -xzf backup.tar.gztar -czf creates a compressed archive (gzip). tar -xzf extracts it. The flags mean: c for create, x for extract, z for gzip compression, f for filename. You will use this constantly for backups and for extracting software that comes as tar.gz files.
zip -r backup.zip /var/www/mysite
unzip backup.zipIf you need to create archives that Windows users can open easily, use zip instead of tar. Most Linux distributions do not have zip installed by default, so you may need to install it first with apt install zip unzip.
SSH is how you connect to your Linux VPS. These commands help you manage SSH access securely.
ssh root@your-server-ip
ssh -p 2222 deploy@your-server-ip
ssh -i ~/.ssh/mykey deploy@your-server-ipThe basic SSH connection uses a username and IP address. The -p flag specifies a non-standard port. The -i flag uses a specific SSH key file. Using SSH keys instead of passwords is strongly recommended for security.
scp file.txt root@your-server-ip:/tmp/
scp -r root@your-server-ip:/var/www/mysite ./backup/scp copies files between your local machine and the server over SSH. The -r flag copies directories recursively. It is the simplest way to transfer files to and from your VPS.
ssh-keygen -t ed25519 -C 'my-vps-key'Generates an SSH key pair. ed25519 is the recommended algorithm in 2026 — it is faster and more secure than the older RSA keys. After generating the key, copy the public key to your server with ssh-copy-id or by manually adding it to ~/.ssh/authorized_keys.
Every VPS connected to the internet needs a firewall. UFW (Uncomplicated Firewall) is the easiest way to manage firewall rules on Ubuntu and Debian.
ufw enable
ufw allow 22
ufw allow 80
ufw allow 443
ufw deny 3306
ufw statusufw enable turns on the firewall. Then you allow the ports you need: 22 for SSH, 80 for HTTP, 443 for HTTPS. Deny ports you want explicitly blocked, like 3306 (MySQL) which should never be exposed to the internet. ufw status shows your current rules.
Always make sure you allow SSH (port 22) before enabling the firewall. If you lock yourself out, you will need to use your hosting provider's console access to fix it.
Looking for an affordable way to get started? Check out our cheap Linux VPS guide to find the right plan for your budget without sacrificing the root access you need for firewall configuration.
Cron lets you run commands on a schedule. Backups, log rotation, update checks — anything you want to happen automatically.
crontab -e
crontab -lcrontab -e opens your cron schedule for editing. crontab -l lists your current scheduled tasks. The cron format uses five fields: minute, hour, day of month, month, day of week.
# Run backup every day at 3 AM
0 3 * * * /root/backup.sh
# Clear temp files every Sunday at midnight
0 0 * * 0 rm -rf /tmp/*
# Check for updates every Monday at 6 AM
0 6 * * 1 apt update && apt upgrade -yThe five asterisks mean every minute of every hour of every day. Replace them with specific values to set your schedule. There are online cron expression generators if the syntax confuses you.
Managing storage is especially important on a VPS where disk space is limited.
lsblkShows all storage devices and their partitions. Useful for understanding your disk layout, especially if you have additional volumes attached to your VPS.
mount /dev/sdb1 /mnt/dataAttaches a storage device to a directory in the file system. If your VPS provider offers additional block storage volumes, you need to mount them before you can use them.
apt autoremove
apt clean
journalctl --vacuum-time=7d
find /var/log -name '*.gz' -deleteWhen your disk fills up, these commands help reclaim space. apt autoremove removes unused packages. apt clean deletes cached package files. journalctl --vacuum-time=7d trims system logs older than 7 days. The find command deletes compressed old log files.
Here is the exact sequence of linux commands to run when you first log into a brand new Linux VPS:
- apt update && apt upgrade -y — update all packages to the latest versions
- adduser deploy — create a non-root user for daily use
- usermod -aG sudo deploy — give the new user sudo privileges
- nano /etc/ssh/sshd_config — change PermitRootLogin to no and change the SSH port from 22 to something random
- systemctl restart sshd — apply the SSH changes
- ufw allow your-new-ssh-port — allow the new SSH port through the firewall
- ufw allow 80 — allow HTTP traffic
- ufw allow 443 — allow HTTPS traffic
- ufw enable — turn on the firewall
- apt install htop curl wget unzip fail2ban — install essential tools
- systemctl enable fail2ban — enable brute-force protection
- reboot — restart to apply all changes cleanly
After this, your VPS is secured, updated, and ready for whatever you want to run on it. The whole process takes about 10 minutes.
Not sure if a VPS is right for you? Read our comparison of VPS vs dedicated servers to understand which option fits your workload and budget.
Here are the most essential linux commands in one place for quick reference:
- pwd — show current directory
- ls -la — list all files with details
- cd /path — change directory
- cp -r source dest — copy files or directories
- mv old new — move or rename
- rm -rf path — delete (careful!)
- cat file — display file contents
- nano file — edit file
- tail -f logfile — follow log in real time
- htop — interactive process monitor
- df -h — disk space usage
- free -h — memory usage
- ss -tlnp — open ports and listening services
- systemctl restart service — restart a service
- grep 'text' file — search inside files
- find / -name 'file' — find files by name
- tar -czf archive.tar.gz dir — create compressed archive
- chmod 755 file — set permissions
- ufw allow port — open firewall port
- crontab -e — edit scheduled tasks
Bookmark this page. You will come back to it more than you think.
Once you are comfortable with these commands, the next step is combining them into shell scripts that automate your server management tasks. A simple backup script that runs via cron can save you from disaster. A monitoring script that checks disk space and sends you an email when it gets low can prevent downtime before it happens.
The linux command line is not just a way to manage your server. It is a programming environment. Every command is a building block, and pipes let you connect them into powerful workflows that would take dozens of clicks in a graphical interface.
Want to squeeze every drop of performance from your server? Our Ryzen 9 9950X VPS performance guide breaks down why hardware matters and how modern CPUs handle real VPS workloads.
Ready to Deploy?
Get a high-performance VPS with instant setup, full root access, and 24/7 support.
Written by Thomas van Herk
Infrastructure Engineer
9+ years in server infrastructure, virtualization, and network architecture.