*Cube-Host– full cloud services!!

TOP useful commands for Linux

Top 100 useful commands for Linux

Commands that make Linux administration faster

If you manage a server, a VPS, or even a local Linux machine, these commands cover 90% of daily tasks: navigation, permissions, troubleshooting, networking, logs, and automation.

Need a server to practice safely? Start with a Linux VPS (root access + full control) — it’s the fastest way to learn real administration skills.

How to use this list

  • Open the manual anytime: man <command>.
  • Most tools support --help for quick syntax.
  • Be careful with destructive commands like rm, dd, fsck (always double-check the target).

A) Navigation and help

  • pwd — show current directory. Example: pwd
  • ls — list files. Example: ls -lah
  • cd — change directory. Example: cd /var/www
  • tree — show directory tree. Example: tree -L 2
  • stat — detailed file info. Example: stat nginx.conf
  • file — detect file type. Example: file backup.tar.gz
  • which — show binary path. Example: which nginx
  • whereis — find binary/source/man paths. Example: whereis python3
  • type — show how shell resolves a command. Example: type ls
  • man — open manual pages. Example: man systemctl

B) Files and directories

  • touch — create/update file timestamps. touch note.txt
  • mkdir — create directory. mkdir -p /backup/daily
  • rmdir — remove empty directory. rmdir emptydir
  • cp — copy files/dirs. cp -a /etc/nginx /backup/
  • mv — move/rename. mv site.conf site.conf.bak
  • rm — remove files (careful). rm -i file.txt
  • ln — create links. ln -s /var/www/site /srv/site
  • rsync — fast sync/copy. rsync -az /backup/ user@host:/data/
  • dd — low-level copy (very careful). dd if=/dev/zero of=test.img bs=1M count=100
  • tar — archive files. tar -czf backup.tar.gz /etc
  • gzip — gzip compress. gzip -9 large.log
  • xz — xz compress. xz -T0 -9 archive.tar
  • zip — zip archive. zip -r site.zip /var/www/site
  • unzip — extract zip. unzip site.zip

C) View and process text

  • cat — print file. cat /etc/os-release
  • less — view large files. less /var/log/syslog
  • head — first lines. head -n 50 file.txt
  • tail — last lines. tail -n 100 file.txt
  • nl — numbered lines. nl -ba file.txt
  • wc — count lines/words. wc -l access.log
  • sort — sort lines. sort users.txt
  • uniq — unique lines. sort file | uniq -c
  • cut — cut columns. cut -d: -f1 /etc/passwd
  • paste — merge lines. paste a.txt b.txt
  • tr — translate chars. tr 'A-Z' 'a-z' < IN
  • sed — stream edits. sed -n '1,20p' file
  • awk — text processing. awk '{print $1}' file
  • grep — search text. grep -R "server_name" /etc/nginx
  • xargs — build commands from input. grep -rl "TODO" . | xargs wc -l
  • tee — write + display. echo "ok" | tee -a status.log

D) Search and locate

  • find — search files by rules. find /var/log -name "*.log" -mtime +7
  • locate — fast filename search. locate nginx.conf
  • updatedb — update locate index. sudo updatedb

E) Permissions and access control

  • chmod — change permissions. chmod 640 file
  • chown — change owner. chown www-data:www-data /var/www -R
  • chgrp — change group. chgrp www-data file
  • umask — default permissions mask. umask 027
  • getfacl — view ACL. getfacl file
  • setfacl — set ACL. setfacl -m u:dev:rw file
  • sudo — run as root safely. sudo systemctl restart nginx
  • su — switch user. su - user

F) Users and password policy

  • id — show UID/GID. id username
  • groups — show groups. groups username
  • useradd — create user. sudo useradd -m -s /bin/bash dev
  • usermod — modify user. sudo usermod -aG sudo dev
  • userdel — delete user. sudo userdel -r dev
  • groupadd — create group. sudo groupadd web
  • groupmod — modify group. sudo groupmod -n webteam web
  • groupdel — delete group. sudo groupdel web
  • passwd — set password. sudo passwd dev
  • chage — password aging. sudo chage -l dev

G) Package management (Debian/Ubuntu + RHEL family)

  • apt — install/update packages (Debian/Ubuntu). sudo apt update && sudo apt install nginx
  • dpkg — low-level .deb tool. dpkg -l | grep nginx
  • dnf — install/update packages (RHEL/Alma/Rocky). sudo dnf install nginx
  • rpm — low-level rpm tool. rpm -qa | grep nginx

H) Services, logs, and troubleshooting

  • systemctl — manage services. sudo systemctl status ssh
  • journalctl — view systemd logs. journalctl -u nginx -n 200 --no-pager
  • dmesg — kernel messages. dmesg | tail

I) Processes and performance

  • ps — process list. ps aux | head
  • top — live monitoring. top
  • htop — better top (if installed). htop
  • pgrep — find PIDs. pgrep nginx
  • pkill — kill by name. pkill -HUP nginx
  • kill — stop by PID. kill -TERM 1234
  • killall — kill by process name. sudo killall nginx
  • nice — start with priority. nice -n 10 command
  • renice — change priority. renice -n 5 -p 1234
  • uptime — load averages. uptime
  • free — RAM usage. free -h
  • vmstat — CPU/memory stats. vmstat 1 5
  • iostat — disk I/O stats (sysstat). iostat -x 2 5

J) Disk and filesystem

  • df — free disk space. df -h
  • du — directory sizes. du -sh /var/*
  • lsblk — block devices. lsblk
  • blkid — UUIDs/types. blkid
  • mount — mount filesystem. mount | grep /dev
  • umount — unmount filesystem. sudo umount /mnt
  • fsck — filesystem check (offline!). sudo fsck /dev/sdb1

K) Networking and connectivity

  • ping — basic connectivity. ping -c 4 8.8.8.8
  • traceroute — route path. traceroute example.com
  • mtr — ping+trace. mtr -rw example.com
  • curl — HTTP requests. curl -I https://example.com
  • wget — download files. wget https://example.com/file.zip
  • dig — DNS lookup. dig A example.com
  • nslookup — DNS lookup (simple). nslookup example.com
  • ip — IP/routes/links. ip a
  • ss — sockets/ports. ss -tulpen
  • nc — test TCP/UDP. nc -zv 127.0.0.1 80
  • tcpdump — packet capture. sudo tcpdump -i eth0 port 443

L) Automation and scheduling

  • crontab — scheduled tasks. crontab -e

Example: daily log cleanup at 03:30

30 3 * * * find /var/log -name "*.log" -mtime +14 -delete

Conclusion

These 100 Linux commands give you a solid admin toolkit: from file operations and permissions to monitoring, networking, and automation. The fastest way to master them is to practice on a real server — a Linux VPS gives you full access and real-world experience.

Prev
Menu