Basic Linux Commands for Server Management
Basic Linux commands for managing a server: files, permissions, disk and RAM usage, processes, services, networking, installing packages and file transfer.

Contents
- Getting started with the command line
- Working with files and folders
- Finding files and filtering content
- File permissions and ownership
- Disk, RAM and CPU usage
- Processes and services
- tmux for long-running tasks
- Network commands
- Package management and updates
- Archiving and file transfers
- Users and permissions
- Nodesty servers for practicing Linux
Linux commands are the basic tool for managing a server. The vast majority of rented VPSs, dedicated servers and game servers run Linux, and you manage them from the command line over SSH rather than through a graphical interface. The good news: almost all day-to-day tasks take just 20–30 commands.
This guide covers the commands you'll use most often when managing a Linux server, grouped by purpose and with examples. If you haven't connected to your server yet, take a look at What is SSH? first.
Getting started with the command line
A command usually has three parts: the command name, options and a target. In ls -la /var/www, ls is the command, -la are the options and /var/www is the target.
A few habits that save time:
- Tab key: Autocompletes file and command names. It also prevents typos.
- Up arrow and
history: Go back to previous commands. Ctrl + C: Stops the running command.Ctrl + R: Searches for a command you typed earlier.man commandorcommand --help: Shows a command's description and options.
Working with files and folders
| Command | What it does |
|---|---|
pwd | Shows the folder you're in |
ls -la | Lists folder contents in detail, including hidden files |
cd /var/www | Changes folder (cd .. goes up one level, cd ~ goes home) |
mkdir -p a/b/c | Creates nested folders in one go |
cp file backup | Copies a file (cp -r for folders) |
mv old new | Moves or renames |
rm file | Deletes a file (rm -r for folders) |
nano file | Edits a file in the terminal |
cat file | Prints a file's contents |
less file | Reads long files page by page (quit with q) |
After editing a file with nano, save with Ctrl + O and Enter, then exit with Ctrl + X.
Careful: Linux has no recycle bin. A folder deleted with rm -r doesn't come back. Double-check the path, especially when typing sudo rm -rf, and take a copy of important files with cp -r before deleting them.
Finding files and filtering content
find /var/www -name "*.log"
grep -r "DB_PASSWORD" /var/www/site
tail -f /var/log/syslog
find: Finds files that match a given name or type.grep: Searches for text inside files.-ralso searches subfolders,-iignores case.tail -f: Shows the last lines of a file and streams new lines live as they're added. It's ideal for following logs;tail -n 100shows the last 100 lines.
You can chain commands together with a pipe (|). For example, ps aux | grep java shows only Java processes.
File permissions and ownership
On Linux, every file has an owner, a group, and read (r), write (w) and execute (x) permissions for those two and for all other users. In ls -l output, they look like -rwxr-xr--.
chmod +x start.sh
chmod 644 config.php
chown -R www-data:www-data /var/www/site
chmod +x: Makes a script executable. Most startup scripts that fail with "Permission denied" are fixed by this.chmod 644: The owner can read and write, everyone else can only read. It's the common value for files; folders use755.chown -R: Changes the owner of files. It's often needed so the web server can write to the files.
Opening everything to everyone with chmod 777 may look like it solves the problem, but it's a serious security hole. Setting the right ownership is always the better solution.
Disk, RAM and CPU usage
| Command | What it shows |
|---|---|
df -h | Used and free space on the disks |
du -sh * | The size of each item in the current folder |
free -h | RAM and swap usage |
uptime | How long the server has been running, and load average |
htop | A live view of CPU, RAM and processes |
nproc | The number of CPU cores |
When the disk fills up, strange errors start on the server: the database can't write and the game server can't save. Find the full disk with df -h and track down large folders with du -sh /*; the usual culprits are old logs, backups and unused Docker images.
In the free -h output, look at the "available" column. Linux uses free RAM as cache, so it's normal for the "free" value to look low.
Processes and services
ps aux | grep node
kill 12345
systemctl status nginx
sudo systemctl restart nginx
journalctl -u nginx -f
ps aux: Lists all running processes. The second column is the process ID (PID).kill PID: Stops a process. For processes that don't respond, usekill -9 PID, but the process then exits without saving.systemctl: Manages services. It hasstart,stop,restartandstatussubcommands, plusenableto start a service automatically at boot.journalctl -u service -f: Follows a service's logs live. If a service won't start, the reason is almost always here.
We cover running your own application as a service, with a systemd example, in our guide to hosting a Discord bot 24/7.
tmux for long-running tasks
When your SSH connection drops, the commands running in that session stop too. Start tasks such as a game server, a long copy or a build inside tmux:
tmux new -s server
Press Ctrl + B then D to detach from the session; the command keeps running in the background. Return with tmux attach -t server, and see open sessions with tmux ls.
Network commands
| Command | What it does |
|---|---|
ip a | Shows the server's IP addresses |
ss -tulpn | Shows which application is listening on which port |
ping yourdomain.com | Checks whether an address is reachable and measures latency |
curl -I https://yourdomain.com | Shows the response headers of a web address |
wget address | Downloads a file |
dig yourdomain.com | Looks up a domain's DNS records |
For connection problems, the first command is usually ss -tulpn; it shows whether the application is actually listening. We cover ports and firewall settings in detail in What is a port?
Package management and updates
Ubuntu and Debian:
sudo apt update
sudo apt upgrade
sudo apt install htop
sudo apt remove package
AlmaLinux and Rocky Linux:
sudo dnf upgrade
sudo dnf install htop
apt update only refreshes the package list; apt upgrade is what installs the updates. Updating your server regularly is the easiest way to close known security holes. After a kernel update, you need to restart with sudo reboot for the change to take effect.
Archiving and file transfers
tar -czf backup.tar.gz /var/www/site
tar -xzf backup.tar.gz
unzip file.zip
tar -czf turns a folder into a single compressed archive, and tar -xzf extracts it. To transfer files between your own computer and the server:
scp backup.tar.gz user@203.0.113.10:/home/user/
rsync -avz ./site/ user@203.0.113.10:/var/www/site/
scp is handy for one-off copies. Because rsync only sends files that have changed, it's far better suited to syncing large folders and resuming interrupted transfers. If you prefer a graphical interface, programs such as WinSCP or FileZilla do the same job over SFTP.
Users and permissions
sudo adduser alice
sudo usermod -aG sudo alice
whoami
Instead of using the server as root all the time, create a user with sudo privileges. On AlmaLinux, the administrator group is called wheel instead of sudo. Creating separate users for game servers and applications also keeps a vulnerability in one application from affecting the whole server.
Nodesty servers for practicing Linux
The best way to learn Linux is to try it on a real server. With Nodesty AMD Ryzen 9 9950X VPS and AMD EPYC 7763 VPS plans, you choose Ubuntu, Debian or AlmaLinux and start with full root access. If a wrong command breaks the server, you can reinstall from the panel or roll back from free daily backups kept for 7 days, and if you lose SSH access, you can still reach your server through the web console.
Frequently Asked Questions
Do I need to memorize Linux commands?
No. In day-to-day server management, 20–30 commands cover most of the work, and you learn them naturally as you use them. When you can't remember a command's options, look up its description with man command or command --help.
What is sudo and when do I use it?
sudo lets a regular user run a single command with administrator (root) privileges. You need it for tasks such as installing packages, editing system files and restarting services. Using sudo instead of working as root all the time limits the damage of accidental mistakes.
Can deleted files be recovered?
On Linux, files deleted with rm don't go to a recycle bin and, as a rule, can't be recovered. So take a copy before deleting anything important and keep regular backups. The daily backups on Nodesty VPS plans give you a safety net against this kind of mistake.
What happens if my SSH connection drops while a command is running?
Normally, when an SSH session closes, the commands running in it stop too. If you start long-running tasks in a tmux or screen session, the command keeps running even if the connection drops, and you can return to the session when you reconnect.
Are the commands the same on Ubuntu and AlmaLinux?
Almost all file, process and network commands are the same. The difference is mostly the package manager; Ubuntu and Debian use apt, while AlmaLinux and Rocky Linux use dnf. The firewall tools differ too; Ubuntu usually has ufw and AlmaLinux has firewalld.
How do I read command output that's very long?
You can read the output page by page with | less, filter only the lines you're looking for with | grep word, or save it to a file with > file.txt. To see only the last lines of log files, use tail.
About the author
Nodesty Team · Infrastructure & Support
The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.
Related articles

How to Upgrade Ubuntu Server to the Next LTS Release
How to upgrade an Ubuntu server to the next LTS release: backups, preparation, do-release-upgrade, SSH access, post-upgrade checks and a clean install.

What Is a Load Balancer and How Does It Work?
What is a load balancer and what does it do? Balancing methods, health checks, session handling, load balancing with Nginx, HAProxy and when you need one.

How to Deploy a Laravel App to a VPS
How to deploy Laravel to a server: PHP-FPM, Composer, .env, the database, file permissions, Nginx, queue workers, the scheduler, SSL and shipping updates.