21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

Linux commands cheat sheet

Quick answer

This Linux commands cheat sheet covers what VPS administrators type daily: pwd, ls, cp and rm for files; find and grep for search; adduser, chmod and chown for access; ps, systemctl and ss for services; df, free and journalctl for troubleshooting; curl and dig for networking; and apt or dnf for updates.

For developers and site owners managing an Ubuntu, Debian, AlmaLinux or Rocky Linux server over SSH.

GuideWebJi®
knowledge
Read time
4 min
Sections
6
Updated
14 Nov 2026
Written by
WebJi® team

Which Linux commands does a VPS administrator need most?

About forty commands cover daily VPS work: moving around files, searching, managing users and permissions, checking processes and ports, reading disk, memory and logs, networking checks, archives and package updates. This sheet groups them by job, with a safe example for each.

Linux command groups covered in this cheat sheet
JobCore commands
Files and directoriespwd, ls, cd, mkdir, cp, mv, rm, less, nano
Searchfind, grep, du
Users and permissionsadduser, usermod, id, chmod, chown
Processes and servicesps, top/htop, systemctl, kill, ss
Disk, memory, logsdf, free, journalctl, tail
Networkip, ping, curl, dig
Archives and transfertar, scp, rsync
Packagesapt (Ubuntu/Debian), dnf (AlmaLinux/Rocky/RHEL)

These need SSH access to a server you administer, such as a Linux VPS; shared hosting rarely gives a full shell. New to SSH? Start with what SSH is.

Which commands manage files and directories?

pwd, ls and cd show and change where you are; mkdir, cp, mv and rm create, copy, move and delete. Linux rm has no recycle bin, so read the path before pressing Enter.

pwd                              # current directory
ls -lah                          # list all files with sizes and permissions
cd /var/www/example.in
mkdir -p ~/backups/2026-11       # -p creates parent folders too
cp -a public ~/backups/2026-11/  # -a keeps permissions and timestamps
mv old-name.html new-name.html
rm -i notes.txt                  # -i asks before deleting
less /etc/nginx/nginx.conf       # read a file; q to quit
nano .env                        # edit; Ctrl+O save, Ctrl+X exit

Copying files between your laptop and the server is covered in the scp command guide.

How do you manage users, sudo and file permissions?

Create a named account for each person with adduser, grant admin rights by adding them to the sudo group, and set file rights with chmod and ownership with chown. Never share the root password or set 777 on web files.

sudo adduser deploy
sudo usermod -aG sudo deploy          # Ubuntu/Debian; use "wheel" on RHEL-family
id deploy                             # confirm group membership
sudo chown -R deploy:www-data /var/www/example.in
find /var/www/example.in -type d -exec chmod 755 {} \;
find /var/www/example.in -type f -exec chmod 644 {} \;
chmod 640 /var/www/example.in/.env
Common permission modes
ModeOwnerGroupOthersUse for
755read, write, executeread, executeread, executeDirectories, scripts
644read, writereadreadNormal web files
640read, writereadnoneConfig files with secrets
600read, writenonenonePrivate keys

The full walkthrough is in adding a sudo user on Ubuntu, and key-based login in generating an SSH key.

How do you check processes, services and open ports?

ps and htop show what is running, systemctl starts, stops and inspects services, and ss lists listening ports. Look before you reboot; a restart hides the evidence.

ps aux --sort=-%mem | head            # top memory users
htop                                  # interactive view (install: sudo apt install htop)
systemctl status nginx --no-pager
sudo systemctl restart php8.3-fpm     # restart one service, not the server
sudo ss -tulpn                        # listening ports and owning processes
kill -15 12345                        # ask process 12345 to stop gracefully

The htop guide explains its columns, and jobs that must run on a schedule belong in cron; see crontab examples.

How do you check disk, memory and logs when a site slows down?

Run df -h for disk space, free -h for memory and swap, and journalctl or tail on log files to see what services last reported. A full disk or exhausted memory explains many sudden failures.

df -h                                  # free space per filesystem
df -i                                  # inodes (file count) per filesystem
free -h                                # RAM and swap
journalctl -u nginx -n 50 --no-pager   # last 50 lines for one service
sudo tail -f /var/log/nginx/error.log  # follow a log live; Ctrl+C to stop
sudo journalctl -k | grep -i "out of memory"

If memory is the bottleneck, how much RAM a VPS needs shows how to size it.

Which commands test the network and handle archives?

ip, ping, curl and dig check addresses, reachability, HTTP responses and DNS; tar and rsync bundle and copy files for backups and moves.

ip -br addr                            # interfaces and addresses
ping -c 4 example.in
curl -I https://example.in             # HTTP status and headers
dig +short A example.in                # what DNS returns
tar -czf site-2026-11-15.tar.gz -C /var/www example.in   # compress a folder
tar -xzf site-2026-11-15.tar.gz        # extract
rsync -avz /var/www/example.in/ deploy@203.0.113.20:/var/www/example.in/

With rsync, the trailing slash on the source means "the contents of this folder"; leaving it off copies the folder itself into the destination.

How do you update packages safely on a production VPS?

On Ubuntu and Debian run apt update then apt upgrade; on AlmaLinux, Rocky and RHEL run dnf check-update then dnf upgrade, reading the package list before accepting. Upgrades can restart PHP or the web server.

# Ubuntu / Debian
sudo apt update
sudo apt upgrade              # review the list; avoid -y on live servers
[ -f /var/run/reboot-required ] && echo "Reboot needed"

# AlmaLinux / Rocky / RHEL
sudo dnf check-update
sudo dnf upgrade

Schedule upgrades for a quiet hour and take a backup or snapshot first. WebJi® Ubuntu VPS hosting gives root access for all of the above; Linux VPS plans start from ₹499 a month before 18% GST.

FAQ

Frequently asked questions

How do I see the manual for any Linux command?

Run man followed by the command, for example man find, and press q to exit. Most commands also print a short summary with --help. Both work offline on the server and match the version installed there.

What is the difference between sudo and su?

sudo runs one command with elevated rights using your own password and logs it. su switches your whole session to another user, usually root, using that user's password. sudo is safer for day-to-day administration.

How do I stop a command that is running?

Press Ctrl+C to interrupt a command in the foreground. For a background process, find its ID with ps or pgrep and run kill with that ID; use kill -9 only if a normal kill does not work.

Do these commands work on macOS too?

Most file, search and network commands do, but options can differ because macOS uses BSD versions. Service and package commands such as systemctl, apt and journalctl are Linux-specific and do not exist on macOS.

Commands checked on Ubuntu 24.04 LTS and AlmaLinux 9 · Reviewed by the WebJi® team, Jaipur.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.