Linux Command Cheat Sheet_ Mastering Linux
Linux Command Cheat Sheet_ Mastering Linux
In this post, I’ve compiled an extensive list of essential Linux commands, along with practical
examples, that are crucial for both day-to-day work and interview preparation. Let's get
started!
Examples
$ pwd
/home/user
$ ls
Documents Downloads Pictures
$ ls -l
drwxr-xr-x 2 user user 4096 Nov 10 08:00 Documents
-rw-r--r-- 1 user user 2048 Nov 10 08:00 file1.txt
$ cd /home/user/Documents
$ cd ..
$ cd ~
Interview Tip: Expect questions on navigating the Linux file system and understanding file
permissions.
Examples
$ touch newfile.txt
$ cp file1.txt /tmp/
$ mv file1.txt backup.txt
$ rm backup.txt
Interview Tip: Expect practical tests where you'll have to create, move, and delete files on a
Linux system.
Examples
$ mkdir newdir
$ ls -d */
$ rmdir newdir
Examples
$ ls -l file1.txt
-rw-r--r-- 1 user user 2048 Nov 10 08:00 file1.txt
Interview Tip: Be prepared to explain how file permissions work, especially the use of r, w, x,
and numeric values (e.g., 755).
Examples
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 20G 30G 40% /
$ du -sh /home/user
2.5G /home/user
$ fdisk -l
Examples
Examples
$ ps aux
$ top
$ kill 1234
$ pkill apache2
Interview Tip: You might be asked to find and kill a specific process using its PID.
8. Networking Commands
Knowing how to troubleshoot and monitor network connections is crucial for any system
administrator or developer:
Examples
$ ping google.com
$ ifconfig
$ netstat -tuln
$ ssh user@host
9. User Management
In multi-user systems, you'll often need to add, remove, or manage users:
Examples
$ useradd newuser
$ passwd newuser
$ userdel newuser
Examples
Examples
$ vmstat 1
$ iostat -x
$ free -h
rsync: Often used for syncing data between directories or servers, with options for
backup.
Examples
$ cp -r /important/data /backup/
$ rsync -avz /source/ /destination/
Examples
Example
$ crontab -e
0 2 * * * /usr/bin/python3 /home/user/scripts/backup.py
Examples
Examples
$ fdisk /dev/sda
$ mkfs.ext4 /dev/sda1
File System Hierarchy: Know where logs, binaries, and configuration files are located.
Basic Networking: Test connectivity using ping, troubleshoot with netstat.
Disk Usage: Check free space, monitor system performance.
Security: Understand file permissions and user management.
Conclusion
Mastering Linux commands is not just about memorization—it’s about understanding how
and when to use them. From file management to system optimization, these commands form
the backbone of any Linux-based infrastructure.
Now, take these commands, run them on your system, and start practicing! Whether you're
preparing for interviews or just looking to improve your Linux skills, consistency is key.