Linux Fundamentals — 50 Commands

Commands grouped by category. Each command shows an example and expected output.

1. File & Directory Management

1. ls — List files in a directory
ls -l
-rw-r--r-- 1 user user  120 Sep 15  file.txt
drwxr-xr-x 2 user user 4096 Sep 15  docs
2. pwd — Print current directory
pwd
/home/user
3. cd — Change directory
cd /var/log
pwd
/var/log
4. mkdir — Create a directory
mkdir projects
ls
projects
5. rmdir — Remove empty directory
rmdir projects
ls
(no projects directory shown)
6. touch — Create empty file
touch notes.txt
ls
notes.txt
7. cp — Copy files
cp notes.txt backup.txt
ls
backup.txt  notes.txt
8. mv — Move/rename file
mv backup.txt archive.txt
ls
archive.txt  notes.txt
9. rm — Delete file
rm archive.txt
ls
notes.txt
10. tree — Display directory structure
tree
.
├── docs
│   └── report.txt
└── notes.txt

2. File Viewing & Editing

11. cat — View file contents
cat notes.txt
This is a note.
12. less — View file page by page
less /etc/passwd
root:x:0:0:root:/root:/bin/bash
...
(Press q to quit)
13. head — Show first 10 lines
head /etc/passwd
14. tail — Show last 10 lines
tail /etc/passwd
15. nano — Open file editor
nano notes.txt
(Opens interactive editor)

3. Permissions & Ownership

16. chmod — Change file permissions
chmod 644 notes.txt
ls -l notes.txt
-rw-r--r-- 1 user user 15 Sep 15 notes.txt
17. chown — Change ownership
sudo chown root notes.txt
ls -l notes.txt
-rw-r--r-- 1 root user 15 Sep 15 notes.txt
18. umask — Show default permissions
umask
0022

4. Search & Filters

19. find — Search files
find . -name "*.txt"
./notes.txt
20. locate — Locate files quickly
locate passwd
/etc/passwd
/usr/share/doc/passwd
21. grep — Search inside files
grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
22. wc — Count lines, words, chars
wc notes.txt
1  4  15 notes.txt
23. sort — Sort file lines
sort names.txt
24. uniq — Remove duplicates
uniq names.txt

5. Archiving & Compression

25. tar — Create archive
tar -cvf backup.tar notes.txt
26. gzip — Compress file
gzip notes.txt
ls
notes.txt.gz
27. gunzip — Decompress
gunzip notes.txt.gz
28. zip — Create zip file
zip archive.zip notes.txt
29. unzip — Extract zip file
unzip archive.zip

6. Process Management

30. ps — Show running processes
ps aux | head -5
31. top — Monitor processes
top
32. htop — Interactive process viewer
htop
33. kill — Terminate process
kill 1234
34. jobs — List background jobs
jobs
35. bg — Resume job in background
bg %1
36. fg — Resume job in foreground
fg %1

7. Networking

37. ping — Test connectivity
ping -c 2 google.com
38. curl — Fetch web content
curl https://example.com
39. wget — Download file
wget https://example.com/file.txt
40. ip addr — Show network info
ip addr
41. ss — Show network sockets
ss -tuln
42. scp — Copy over SSH
scp notes.txt user@192.168.1.10:/home/user/
43. ssh — Remote login
ssh user@192.168.1.10

8. System Information

44. uname — Show system info
uname -a
45. df — Disk usage
df -h
46. du — Directory size
du -sh /var/log
47. free — Memory usage
free -h
48. uptime — System uptime
uptime
49. who — Logged-in users
who
50. history — Show command history
history | tail -5

← Back to Fundamentals Index ↑ Back to EXPANDED