
Share this post
Linux is an incredibly powerful and flexible operating system. Whether you're a complete beginner or just need a quick refresher, this cheat sheet covers essential Linux commands to help you navigate, manage files, control processes, and perform basic administrative tasks.
1. Basic Commands
- uname -a → Display system information
- hostname → Show or set the system hostname
- whoami → Display the current logged-in user
- pwd → Print the current working directory
2. Navigating the Filesystem
- ls → List files in a directory
- ls -l → Show detailed information about files
- ls -a → Show hidden files
- cd [directory] → Change directory
- cd .. → Move one level up
- cd ~ → Move to the home directory
3. File Management
- touch filename → Create a new empty file
- rm filename → Delete a file
- rm -r directory → Delete a directory and its contents
- cp source destination → Copy files
- mv oldname newname → Move or rename files
- cat filename → Display file contents
- less filename → View file contents page by page
4. File Permissions and Ownership
- ls -l → View file permissions
- chmod 755 filename → Change file permissions
- chown user:group filename → Change file owner and group
5. Searching and Finding Files
- find /path -name filename → Search for a file by name
- grep 'text' filename → Search for a keyword inside a file
6. Process Management
- ps aux → View running processes
- top → Show real-time system resource usage
- kill PID → Terminate a process
- pkill process_name → Kill a process by name
7. Networking Basics
- ifconfig → Show network configuration
- ping example.com → Test connectivity to a website
- wget URL → Download a file from the internet
- curl URL → Fetch content from a URL
8. Disk Management
- df -h → Show disk space usage
- du -sh folder → Show the size of a directory
- mount /dev/sdb1 /mnt → Mount a drive
- umount /mnt → Unmount a drive
9. User and Group Management
- who → List logged-in users
- adduser username → Create a new user
- passwd username → Change a user password
- deluser username → Delete a user
10. Package Management
Debian-based (Ubuntu, Debian, etc.)
- sudo apt update → Update package list
- sudo apt upgrade → Upgrade installed packages
- sudo apt install package-name → Install a package
- sudo apt remove package-name → Remove a package
RedHat-based (CentOS, Fedora, etc.)
- sudo yum update → Update all packages
- sudo yum install package-name → Install a package
- sudo yum remove package-name → Remove a package
11. System Monitoring and Logs
- free -h → Show memory usage
- vmstat → Display system performance stats
- iostat → Show CPU and I/O statistics
- dmesg | tail → View last kernel messages
12. Task Scheduling
- crontab -e → Edit cron jobs
- crontab -l → List scheduled cron jobs
- 0 5 * * * /path/to/script.sh → Run a script every day at 5 AM
13. Exiting and Shutting Down
- exit → Close the session
- shutdown -h now → Shutdown immediately
- reboot → Restart the system
Conclusion
Mastering these Linux commands will help you navigate and manage a Linux system efficiently. As you gain more experience, explore intermediate and advanced commands to enhance your productivity. If you’re interested in an Advanced Linux Commands Cheat Sheet, let us know!
