Fundamentals 28 min read

Essential Linux Command Line Cheat Sheet for Beginners (70+ Commands)

This guide compiles around 70 essential Linux command‑line utilities, covering navigation, file manipulation, text processing, permission handling, user management, archiving, disk operations, and system monitoring, with clear examples and practical tips for newcomers to master the shell.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Essential Linux Command Line Cheat Sheet for Beginners (70+ Commands)

Part 1: Basic navigation commands

pwd – prints the current working directory. pwd Output example: /home/user/Documents ls – lists files and directories. Use -l for detailed view and -a to include hidden files. ls -l cd – changes the current directory. cd without arguments returns to the home directory.

cd ~
cd ~/Desktop
cd ..
cd -

clear – clears the terminal screen.

clear

Part 2: File operations

touch – creates an empty file. touch newfile.txt mkdir – creates a directory. Use -p for recursive creation.

mkdir my_folder
mkdir -p parent_folder/child_folder

cp – copies files or directories. Add -r for recursive copy.

cp file.txt backup.txt
cp -r my_folder my_folder_copy

mv – moves or renames files.

mv old_name.txt new_name.txt
mv file.txt /home/user/Documents/
mv file.txt /home/user/Documents/new_name.txt

rm – removes files or directories. Use -r for recursive deletion and -f to force.

rm file.txt
rm -r my_folder
rm -rf my_folder

Part 3: Text viewing and processing

cat – displays file contents; can concatenate multiple files.

cat file1.txt
cat file1.txt file2.txt > combined.txt
cat -n combined.txt

tac – displays file contents in reverse order. tac file.txt less and more – paginated viewers. less supports forward/backward scrolling and searching.

more file.txt
less file.txt

head and tail – show the beginning or end of a file. Use -n to specify line count; -f follows a growing file.

head -n 5 file.txt
tail -n 8 file.txt
tail -f file.txt

grep – searches text using patterns. Common options: -i (ignore case), -n (line numbers), -c (count), -l (list filenames), -v (invert match), -R (recursive).

grep "error" logfile.txt
grep -i "error" logfile.txt
grep -n "error" logfile.txt
grep -R "keyword" /path/to/dir
grep -v "error" logfile.txt
grep -E "error|fail" logfile.txt
grep -c "error" logfile.txt
grep -l "error" *.txt

find – locates files by name, type, size, time, etc., and can execute actions on matches.

find . -name "file.txt"
find /path/to/dir -iname "*test*"
find . -type d
find . -size +10M
find . -mtime -7
find . -name "*.log" -exec rm {} \;

sed – stream editor for in‑place text transformations.

sed 's/old/new/g' file.txt
sed -i 's/old/new/g' file.txt
sed '/unwanted/d' file.txt
sed -n '5p' file.txt
sed 's/$/ END/' file.txt

awk – powerful pattern‑scanning and processing language.

awk '{print $1, $3}' file.txt
awk '/error/ {print}' file.txt
awk '$3 > 100 {print}' file.txt
awk -F ',' '{print $2}' file.csv
awk 'END {print NR}' file.txt
awk '{sum += $3} END {print sum}' file.txt

wc – counts lines, words, and bytes.

wc -l file.txt
wc -w file.txt

Part 4: Permission management

chmod – changes file mode (permissions). Numeric (e.g., 755) and symbolic ( +x) forms are supported; -R applies recursively.

chmod 755 script.sh
chmod 600 secret.txt
chmod -R +x /path/to/dir
chmod +x script.sh
chmod -w readonly.txt
chmod g+w shared_file.txt
chmod u=rwx,g=rx,o= script.sh

chown – changes file owner and optionally group. Use -R for recursion.

sudo chown user1 file.txt
sudo chown user1:group1 file.txt
sudo chown -R user1:group1 /path/to/dir

chgrp – changes the group ownership of a file or directory.

sudo chgrp group1 file.txt
sudo chgrp -R group1 /path/to/dir

Part 5: User management

adduser – creates a new system user and its home directory. sudo adduser john deluser – removes a user but leaves the home directory untouched. sudo deluser john passwd – changes a user's password; prepend sudo to modify another user.

passwd
sudo passwd username

id – shows UID, GID, and group memberships.

id
id username

whoami , who , w – display logged‑in users and their activity.

whoami
who
w

Part 6: Archiving and compression

tar – creates and extracts archives; add -z for gzip compression.

tar -cvf archive.tar file1 file2
tar -xvf archive.tar
tar -czvf archive.tar.gz file1 file2
tar -xzvf archive.tar.gz

zip / unzip – compresses and extracts ZIP files. Use -r to include directories.

zip archive.zip file1 file2 -r dir
unzip archive.zip

gzip / gunzip – compresses or decompresses single files. -k keeps the original.

gzip file.txt
gzip -k file.txt
gunzip file.txt.gz
gunzip -k file.txt.gz

Part 7: Disk and device management

mount – attaches a filesystem to a directory; umount detaches it.

sudo mount /dev/sdb1 /mnt
sudo umount /mnt

fsck – checks and repairs filesystem inconsistencies. Common flags: -y (auto‑repair), -n (no‑repair), -f (force).

sudo fsck /dev/sda1
sudo fsck -f /dev/sda1
sudo fsck -n /dev/sda1
sudo fsck -y /dev/sda1

lsblk – lists block devices and their partitions.

lsblk -a
lsblk -f

Part 8: System information and monitoring

hostname – shows or sets the system's host name.

hostname
sudo hostname new-hostname
sudo hostnamectl set-hostname new-hostname

uname – prints kernel and system information.

uname
uname -a
uname -s
uname -r
uname -m

top – interactive view of CPU and memory usage; press q to quit. Use P to sort by CPU and M by memory. top ps – snapshots current processes; combine with grep to filter.

ps aux
ps aux | grep process_name

kill – terminates processes by PID; -9 forces termination.

kill 12345
kill -9 12345

free – displays memory usage; -h for human‑readable, -s for continuous monitoring.

free
free -h
free -s 1

df – reports filesystem disk space usage; -h makes it human‑readable.

df
df -h
df -h /path/to/dir

du – estimates file and directory space usage; -h for readability, -s for summary.

du
du -h
du -sh
du -h /path/to/dir

Conclusion

These commands form the core toolkit for everyday Linux work, covering navigation, file handling, text processing, permissions, user administration, archiving, device control, and system monitoring. Mastering them equips beginners with the confidence to tackle real‑world tasks and lays a solid foundation for deeper Linux expertise.

Mind map of Linux command categories
Mind map of Linux command categories
Promotional image (removed from core content)
Promotional image (removed from core content)
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.

Linuxcommand-lineUnixTutorialbasics
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.