Server Management (Unmanaged)

Expert Guide to Server Management in Linux: Mastering Shell Commands for Linux

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

Running your own Linux server comes down to a few dozen commands used well: installing and updating software, starting and stopping services, reading logs, watching disk, memory and processes, and controlling the firewall. This guide covers those commands for the Red Hat family of distributions, AlmaLinux and Rocky Linux, as they work in 2026, and replaces older tools such as ifconfig and netstat with their current equivalents.

Key takeaways

On AlmaLinux and Rocky Linux, use dnf for packages, systemctl for services, journalctl for logs, ss and ip for networking, and firewall-cmd for the firewall. Check health with df -h, free -h, top and dmesg -T. Remember that SELinux is on by default and that the default filesystem is XFS, so restorecon and xfs_repair matter more than older guides suggest. Look before you change anything, and treat rm -rf and kill -9 as last resorts.

For your own VPS or server

These commands need root or sudo, so they apply to a VPS or dedicated server you control. On Domain India shared hosting you get a jailed shell for your own account only; for that, read how to log in using SSH and essential Linux commands.

1. Which distributions this covers

CentOS Linux has reached end of life: CentOS 8 ended in 2021 and CentOS 7 in June 2024, so neither gets security updates any more. The community replacements are AlmaLinux and Rocky Linux, both rebuilt from Red Hat Enterprise Linux and command-for-command compatible with it. CentOS Stream still exists, but it is the development stream ahead of RHEL rather than a stable server release. Everything below works on current AlmaLinux, Rocky Linux and RHEL releases.

Find out what you are running with:

bash
cat /etc/os-release
hostnamectl
uname -r        # running kernel

2. Old commands and their current replacements

Many older tutorials still show tools that are deprecated or missing on a minimal install.

Older commandUse nowWhat it does
ifconfigip addr, ip linkShow interfaces and IP addresses
routeip routeShow the routing table
netstat -tulpnss -tulpnList listening ports and the programs using them
yumdnfInstall, update and remove packages
service httpd restartsystemctl restart httpdControl a service
chkconfig httpd onsystemctl enable httpdStart a service at boot
tail /var/log/messagesjournalctlRead system and service logs
iptables -Lfirewall-cmd --list-allShow firewall rules (firewalld uses nftables underneath)

3. Files, directories and searching

bash
pwd; ls -lah                     # where am I, and what is here (with hidden files)
cd /var/www; cd -                # go somewhere, then back
cp -a site site.bak              # copy, keeping owners, permissions and times
mv old.conf old.conf.disabled    # move or rename
mkdir -p /srv/app/releases       # create a folder and any missing parents
find /var/log -name "*.log" -mtime -1    # logs changed in the last day
grep -rn "DocumentRoot" /etc/httpd/      # search inside files, with line numbers
tar -czf etc-backup.tar.gz /etc          # pack a folder
tar -xzf etc-backup.tar.gz -C /tmp/restore   # unpack elsewhere
less /etc/ssh/sshd_config                # read a long file (q quits, / searches)

Use nano for quick edits, or vi (vim on most installs) if you know it. Take a copy of any configuration file before you change it.

rm -rf has no undo

rm -rf deletes immediately and recursively, and as root it can delete the whole system. Run pwd and ls first, never use it with a variable that might be empty (rm -rf "$DIR"/ with an empty $DIR becomes rm -rf /), and prefer moving files to a holding folder when you aren't sure.

4. Permissions, ownership and SELinux

bash
chmod 644 file; chmod 755 folder     # usual web permissions
chown -R apache:apache /var/www/site # change owner and group
ls -Z /var/www/site                  # show SELinux labels
restorecon -Rv /var/www/site         # reset labels to the policy default
getenforce                           # Enforcing, Permissive or Disabled

SELinux is enforcing by default on AlmaLinux and Rocky Linux. When a service gets "permission denied" although the Unix permissions look right, check ausearch -m avc -ts recent or journalctl -t setroubleshoot and fix the label or boolean, for example setsebool -P httpd_can_network_connect 1. Switching SELinux off hides the problem and removes a layer of protection. Never use chmod 777.

5. Packages and updates

bash
sudo dnf check-update              # what can be updated
sudo dnf -y upgrade                # update everything
sudo dnf install httpd             # install a package
sudo dnf search redis              # find a package
sudo dnf history                   # what changed, and when
sudo dnf history undo 42           # roll back transaction 42
sudo dnf -y install epel-release   # extra packages (htop, certbot and more)
sudo dnf needs-restarting -r       # does the server need a reboot?

For unattended security updates, install dnf-automatic, set upgrade_type = security in /etc/dnf/automatic.conf and enable dnf-automatic-install.timer.

6. Services and logs

bash
systemctl status nginx                # is it running, and its latest log lines
sudo systemctl restart nginx          # restart
sudo systemctl reload nginx           # re-read config without dropping connections
sudo systemctl enable --now nginx     # start now and at every boot
systemctl --failed                    # anything that failed to start
journalctl -u nginx --since "1 hour ago"
journalctl -p err -b                  # errors since the last boot
journalctl -f                         # follow new log lines live

Test a configuration before you reload it: nginx -t, apachectl configtest or sshd -t. A reload with a broken config can take the service down.

7. Disk space and filesystems

bash
df -h                               # free space per filesystem
df -i                               # free inodes (many small files can fill these first)
du -xh --max-depth=1 / | sort -h    # biggest top-level folders
lsblk -f                            # disks, partitions and filesystem types
findmnt                             # what is mounted where
sudo journalctl --vacuum-size=500M  # shrink the system journal

The default filesystem on AlmaLinux and Rocky Linux is XFS, which is repaired with xfs_repair, not fsck or e2fsck. Run any filesystem repair only on an unmounted filesystem; on a VPS that usually means booting a rescue system from your provider. Running a repair on a mounted disk can destroy data.

8. Processes and scheduled jobs

bash
top                         # live CPU and memory by process (press M or P to sort)
ps aux --sort=-%mem | head  # the biggest memory users
pgrep -a php-fpm            # find processes by name
kill 12345                  # ask a process to stop (SIGTERM)
kill -9 12345               # force it, only if SIGTERM fails
crontab -e                  # edit your scheduled jobs
systemctl list-timers       # scheduled systemd timers

Services should be stopped with systemctl, not kill, so systemd knows what happened. For cron syntax, see what are cron job commands.

9. Networking, SSH and the firewall

bash
ip -br addr                 # interfaces and addresses, one line each
ip route                    # default gateway
sudo ss -tulpn              # listening ports and owning programs
curl -I https://example.com # check a website's response headers
dig +short example.com      # DNS lookup (from bind-utils)
sudo firewall-cmd --list-all
sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload
ssh -i ~/.ssh/id_ed25519 deploy@server   # log in with a key
scp file.tar.gz deploy@server:/srv/      # copy a file over SSH
rsync -avz ./site/ deploy@server:/var/www/site/   # sync only what changed

Use SSH keys and turn off password and root logins; see the SSH security hardening checklist. For firewall rules in depth, read modern firewall management with nftables.

10. Health checks and troubleshooting

bash
uptime                 # load averages over 1, 5 and 15 minutes
free -h                # memory and swap
vmstat 1 5             # CPU, memory and I/O, sampled five times
dmesg -T | tail -50    # kernel messages with readable times (out-of-memory kills show here)
lscpu; lsblk           # CPU and disk layout

A load average consistently above your number of CPU cores means work is queuing. On a VPS the disks are virtual, so SMART tools such as smartctl usually have nothing to read; disk hardware is your provider's job, and your job is free space and I/O. lshw isn't installed by default; lscpu, lsblk and free cover most needs.

11. Where Domain India fits

A Domain India VPS gives you full root access over SSH and a choice of Linux, including AlmaLinux and Rocky Linux, so every command in this guide works on it. It is self-managed: you are responsible for updates, security and backups. Prices on the card are live and exclude 18% GST.

VPS Starter
₹552.65/mo + GST
  • 1 vCPU
  • 2 GB DDR4 RAM
  • 64 GB NVMe SSD Storage
  • 2 TB Monthly Bandwidth
See plan details

If you want a website without running a server, shared hosting such as cPanel hosting is managed for you, with jailed SSH available on request.

Frequently asked questions

Is CentOS still safe to use on a server?

No for CentOS Linux. CentOS 8 reached end of life in 2021 and CentOS 7 in June 2024, so they no longer receive security updates. Move to AlmaLinux or Rocky Linux, which are compatible with the same commands.

Why is ifconfig not found on my server?

ifconfig belongs to the old net-tools package, which minimal installs no longer include. Use ip addr to see addresses and ss -tulpn instead of netstat to see listening ports.

Should I use yum or dnf?

Use dnf. On current AlmaLinux and Rocky Linux, yum is only an alias for dnf, and all documentation now uses dnf.

How do I find what is filling my disk?

Run df -h to see which filesystem is full, then du -xh --max-depth=1 on that filesystem, sorted with sort -h, and repeat inside the largest folder. Check df -i too, because running out of inodes also stops writes.

Can I run fsck on my VPS disk?

Only on an unmounted filesystem, which usually means booting a rescue system. AlmaLinux and Rocky Linux use XFS by default, which is repaired with xfs_repair rather than fsck.

Can I use these commands on shared hosting?

Only the file, search and archive commands inside your own account. Shared hosting gives a jailed shell without root, so dnf, systemctl, firewall-cmd and similar commands need a VPS.

Ready to manage your own server? Compare VPS plans, start with the SSH hardening checklist, or see managing your domain and VPS without a control panel for a first website. Questions? Open a support ticket or use our 24/7 live chat.

Get a server you control

Full root access over SSH, KVM virtualisation and your choice of Linux, including AlmaLinux and Rocky Linux.

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
Linux Server Management Commands (AlmaLinux) | Domain India