Server Management (Unmanaged)

Basic VPS Server Management Commands

By the Domain India teamPublished 6 min read
Knowledge base article
Contents (9 sections)

These are the Linux commands you will use most on a VPS you manage yourself: finding your way around, services, packages, users, disk space, networking, processes and scheduled jobs. Each block gives the Ubuntu/Debian and AlmaLinux/Rocky Linux form where they differ.

For your own VPS or server

These commands need root or sudo, which you have on a Domain India VPS but not on shared hosting. On shared hosting you get a jailed shell instead; see SSH and essential commands for shared hosting. For explanations and more examples, read the full guide: Linux server mastery: essential shell commands.

Key takeaways

Log in with an SSH key as a normal user and use sudo for admin work. Use apt (Ubuntu, Debian) or dnf (AlmaLinux, Rocky) for packages, systemctl and journalctl for services and logs, ip and ss for networking, and df, du and free to see what is running out. Look before you change anything, and never run poweroff on a VPS unless support asks you to.

1. Files and folders

bash
pwd                          # where am I?
ls -lah                      # list files with sizes, including hidden ones
cd /var/www                  # change folder
mkdir -p /srv/app/logs       # create a folder and its parents
cp -a site site.bak          # copy, keeping permissions and dates
mv old.conf new.conf         # rename or move
rm file.txt                  # delete a file (there is no recycle bin)
chmod 644 index.php          # files: owner read/write, others read
chmod 755 /srv/app           # folders: owner full, others read and enter
chown -R www-data:www-data /var/www/site   # Ubuntu/Debian web user

On AlmaLinux and Rocky the web server user is usually apache or nginx. Never use chmod 777.

rm -rf does not ask

rm -rf deletes a folder and everything in it at once, with no undo. Run ls on the exact path first, and watch for a stray space: rm -rf /var/www/ oldsite deletes all of /var/www, not just oldsite, and keep a backup before any clean-up.

2. Services and logs (systemd)

bash
sudo systemctl status nginx       # is it running? shows the last log lines
sudo systemctl restart nginx      # restart after a change
sudo systemctl reload nginx       # reload config without dropping connections
sudo systemctl enable --now nginx # start now and at every boot
systemctl --failed                # anything that failed to start
sudo journalctl -u nginx -n 50    # last 50 log lines for one service
sudo journalctl -f                # follow the system log live

Test a config before reloading, for example sudo nginx -t or sudo apachectl configtest.

3. Packages and updates

TaskUbuntu, DebianAlmaLinux, Rocky Linux
Refresh the package listsudo apt updatesudo dnf check-update
Install updatessudo apt upgradesudo dnf upgrade
Install a packagesudo apt install htopsudo dnf install htop
Remove a packagesudo apt remove htopsudo dnf remove htop
Searchapt search keyworddnf search keyword
Clean up unused packagessudo apt autoremovesudo dnf autoremove

On AlmaLinux and Rocky, yum is only an alias for dnf. Some tools, such as htop, come from the EPEL repository there: sudo dnf install epel-release first.

4. Users and sudo

bash
sudo adduser deploy              # Ubuntu/Debian: create a user interactively
sudo useradd -m deploy && sudo passwd deploy   # AlmaLinux/Rocky
sudo usermod -aG sudo deploy     # Ubuntu/Debian: allow sudo
sudo usermod -aG wheel deploy    # AlmaLinux/Rocky: allow sudo
sudo userdel -r olduser          # delete a user and their home folder
getent passwd                    # list accounts

Log in as a normal user with an SSH key and switch password login off; see SSH key authentication and the SSH hardening checklist.

5. Disk, memory and CPU

bash
df -h                            # free space on each disk
df -i                            # free inodes (a full inode table also stops writes)
sudo du -xh --max-depth=1 / | sort -h     # which top-level folders are biggest
sudo find / -xdev -type f -size +100M -exec ls -lh {} +   # files over 100 MB
free -h                          # memory and swap
uptime                           # load average
nproc                            # number of CPUs
top                              # live processes (q to quit)

6. Network

bash
ip addr show                     # IP addresses
ip route                         # default gateway
ss -tulpn                        # listening ports and the program on each
ping -c 4 example.com            # basic reachability
dig example.com +short           # DNS lookup
curl -I https://example.com      # fetch only the headers of a page

ifconfig and netstat come from the old net-tools package and are often not installed; ip and ss replace them. For the firewall, use ufw on Ubuntu or firewall-cmd on AlmaLinux and Rocky; see VPS firewall setup.

7. Processes and scheduled jobs

bash
ps aux | grep php                # find a process
kill 12345                       # ask a process to stop
kill -9 12345                    # force it (last resort)
crontab -e                       # edit your scheduled jobs
crontab -l                       # list them

A cron line is minute hour day month weekday command, for example 30 2 * * * /home/deploy/backup.sh runs every day at 02:30. More patterns are in cron job commands.

8. Rebooting safely

Restart the one service that misbehaves before you reboot the whole server. When you do need a reboot, use sudo reboot. Don't run poweroff or shutdown -h: a VPS switched off from inside stays off until support starts it. The client area has no VPS control page, so for a start, force restart, reinstall or resize, open a ticket with the VPS IP address. See managing your VPS: start, stop and reboot.

Frequently asked questions

Do these commands work on shared hosting?

Most don't. Package, service, user and firewall commands need root access, which you have on a VPS but not on shared hosting. Shared hosting offers a jailed shell on request, where file, log and disk commands work.

Should I use yum or dnf?

On AlmaLinux and Rocky Linux, use dnf. The yum command still works but is only an alias for dnf.

How do I find what is filling my VPS disk?

Run df -h to see which disk is full, then sudo du -xh --max-depth=1 / piped to sort -h to find the biggest folders, and go deeper from there. Logs, backups and old packages are the usual causes.

How do I restart my VPS?

Run sudo reboot over SSH. Do not use poweroff, because a VPS switched off from inside stays off. If the VPS is not responding, open a ticket with its IP address.

Ready to go further? Work through the Linux server mastery guide, secure the server with the VPS security checklist, or compare VPS plans.

A server you control

KVM VPS plans with full root access, NVMe storage and a choice of Linux operating system.

See VPS plans

Ready when you are

Get VPS from ₹552.65/mo + GST

See plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Basic VPS Management Commands (Linux) | Domain India