Operations 12 min read

The Ultimate Linux Command Cheat Sheet: From Beginner to Pro

This comprehensive guide organizes essential Linux commands into five core modules—file, disk, compression, process, and network management—providing concise descriptions, syntax, key options, and concrete examples for each command to help beginners quickly become proficient.

Golang Shines
Golang Shines
Golang Shines
The Ultimate Linux Command Cheat Sheet: From Beginner to Pro

Linux commands are essential tools for system administrators, developers, and security engineers. This guide groups the most frequently used commands into five core modules—file management, disk management, compression, process management, and network management—offering a brief functional description, command syntax, important options, and concrete usage examples for each command.

File Management Commands

basename – removes directory path and file suffix. Syntax: basename [filename] [suffix]. Example: basename include/stdio.h .h → outputs "stdio". Options: --help, --version.

cat – concatenates and displays file contents. Syntax: cat [-AbeEnstTuv] [filename]. Options: -n (number all lines), -b (number non‑blank lines), -s (squeeze blank lines). Example: cat -n textfile1 > textfile2 (add line numbers while saving).

cd – changes the working directory. Syntax: cd [target directory]. Common usages: cd / (root), cd ~ (home), cd .. (parent).

chgrp – changes the group ownership of files or directories. Syntax: chgrp [options] [group] [file/dir]. Important options: -R (recursive), -v (verbose), --reference=<file> (use reference file's group).

chmod – modifies file or directory permissions. Syntax: chmod [ugoa][+-=][rwx] [file/dir] or chmod [numeric mode] [file/dir]. Permission symbols: u (owner), g (group), o (others), a (all); r =4, w =2, x =1. Example: chmod u+x test.sh (add execute for owner) or chmod 755 test.sh (owner rwx, others r-x).

Other common file commands include chown ( chown user:group file), cp ( cp -r source dest for recursive copy, -i to prompt before overwrite), mv ( mv -i source dest), rm ( rm -r for directories, -f force, -i prompt), ln , touch ( touch file.txt creates empty file, touch -d "2025-12-01" file.txt sets timestamp), and find ( find / -name "*.txt").

Disk Management Commands

df – displays disk space usage. Syntax: df [-ahHiklmPT] [file|device]. Common options: -h (human‑readable), -i (inode usage), -T (filesystem type).

du – shows disk usage of files and directories. Syntax: du [-abcDhHklmsSx] [path]. Options: -h (human‑readable), -s (summary only), --max-depth=1 (show only first‑level subdirectories).

mount / umount – mounts and unmounts filesystems. Example mount: mount -t vfat /dev/sdd1 /mnt/usb. Example unmount: umount /mnt/usb. Also supports mounting ISO images: mount -o loop /home/test.iso /mnt/cdrom.

Additional disk utilities: fdisk ( fdisk -l lists partitions), free ( free -m shows memory in MB), format (rarely used for formatting disks).

Compression Management Commands

gzip / gunzip – compresses/decompresses .gz files. Example: gzip test.txt, gunzip test.txt.gz.

bzip2 / bunzip2 – high‑ratio compression for .bz2. Example: bzip2 -k test.txt (keep original).

tar – creates and extracts archives. Example: tar -zcvf test.tar.gz test/ (create compressed archive), tar -zxvf test.tar.gz (extract).

zip / unzip – cross‑platform archive format. Example: zip -r test.zip test/, unzip test.zip -d /home.

split – splits large files into smaller pieces. Example: split -b 100M large.file (creates 100 MiB chunks).

zgrep – searches within compressed .gz or .bz2 files. Example: zgrep "error" test.log.gz.

Process Management Commands

ps – displays process status. Syntax: ps [-aAcdefHjlmNVwy] [options]. Common usages: ps -ef (full listing), ps -aux (resource usage).

top – real‑time process monitor. Syntax: top [bciqsS] [d interval]. Interactive keys: k (kill), P (sort by CPU), M (sort by memory).

kill – terminates processes. Syntax: kill [-s signal] PID. Signal 15 is default (graceful), 9 forces termination ( kill -9 PID).

crontab – schedules recurring tasks. Edit with crontab -e, list with crontab -l.

nohup – runs a command immune to hangups. Example: nohup ./test.sh &.

renice – changes process priority. Example: renice -5 PID (increase priority).

who – shows currently logged‑in users.

Network Management Commands

ifconfig / ip – configure and view network interfaces. Example: ifconfig eth0 192.168.1.100 netmask 255.255.255.0, ip addr show, ip link set eth0 up.

ping – tests connectivity. Syntax: ping [-c count] host. Example: ping -c 4 baidu.com.

netstat – displays network connections. Example: netstat -tuln (list listening TCP/UDP ports), netstat -anp (all connections with processes).

curl – transfers data with URLs. Examples: curl -O https://test.com/file.zip (download), curl -d "user=test&pwd=123" https://test.com/login (POST), curl -C - -O https://test.com/large.file (resume).

Other network utilities: nslookup ( nslookup baidu.com), route ( route -n view routing table), tcpdump ( tcpdump -i eth0 port 80 capture traffic), finger , ftp ( ftp ip).

This reference provides a ready‑to‑use cheat sheet for over 50 common Linux commands, each with clear explanations and practical examples, making it a valuable resource for anyone learning or working with the Linux command line.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

process managementNetworkLinuxcommand-linesysadminfile management
Golang Shines
Written by

Golang Shines

We share daily the latest Golang technical articles, practical resources, language news, tutorials, and real-world projects to help everyone learn and improve.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.