Linux is a powerful and flexible operating system that is widely used in various environments, from personal computers to servers. For beginners, navigating through Linux can be daunting due to its command-line interface. However, with the right set of commands, you can quickly become proficient in managing your Linux system. This beginner Linux command cheat sheet covers essential commands that will help you get started and become more comfortable using Linux.
Getting Started Beginner Linux Command Cheat Sheet Free
Before diving into the commands, it’s important to understand the terminal, the command-line interface used to interact with the Linux operating system. You can open the terminal in most Linux distributions by pressing Ctrl + Alt + T.
Basic Commands
1. pwd (Print Working Directory)
Displays the current directory you are in.
sh Copy code
pwd2. ls (List)
Lists files and directories in the current directory.
sh Copy code
lsOptions:
ls -l: Lists files in long format.ls -a: Lists all files, including hidden ones.
3. cd (Change Directory)
Changes the current directory.
sh Copy code
cd /path/to/directorycd ~: Changes to the home directory.cd ..: Moves up one directory level.
4. mkdir (Make Directory)
Creates a new directory.
sh Copy code
mkdir new_directory5. rmdir (Remove Directory)
Deletes an empty directory.
sh Copy code
rmdir directory_name6. rm (Remove)
Deletes files or directories.
sh Copy code
rm file_nameOptions:
rm -r directory_name: Deletes a directory and its contents recursively.
7. touch
Creates an empty file or updates the timestamp of an existing file.
sh Copy code
touch new_file8. cp (Copy)
Copies files or directories.
sh Copy code
cp source_file destination_fileOptions:
cp -r source_directory destination_directory: Copies directories recursively.
9. mv (Move)
Moves or renames files or directories.
sh Copy code
mv old_name new_name10. cat (Concatenate)
Displays the contents of a file.
sh Copy code
cat file_name11. nano
Opens the Nano text editor to edit files.
sh Copy code
nano file_nameSystem Information
12. uname
Displays system information.
sh Copy code
uname -a13. top
Shows real-time system processes and resource usage.
sh Copy code
top14. df (Disk Free)
Displays disk space usage.
sh Copy code
df -h15. du (Disk Usage)
Shows the size of a directory and its contents.
sh Copy code
du -sh directory_name16. free
Displays memory usage.
sh Copy code
free -hFile Permissions
17. chmod (Change Mode)
Changes file permissions.
sh Copy code
chmod 755 file_name18. chown (Change Owner)
Changes file owner and group.
sh Copy code
chown user:group file_nameSearching and Finding Files
19. find
Searches for files in a directory hierarchy.
sh Copy code
find /path/to/search -name file_name20. grep (Global Regular Expression Print)
Searches for a pattern within files.
sh Copy code
grep "pattern" file_nameOptions:
grep -r "pattern" /path/to/search: Recursively searches within a directory.
Network Commands
21. ping
Checks connectivity to a host.
sh Copy code
ping host_name_or_ip22. ifconfig
Displays network configuration.
sh Copy code
ifconfig23. wget
Downloads files from the internet.
sh Copy code
wget http://example.com/file24. ssh (Secure Shell)
Connects to a remote server securely.
sh Copy code
ssh user@hostProcess Management
25. ps (Process Status)
Displays currently running processes.
sh Copy code
ps aux26. kill
Terminates a process by PID (Process ID).
sh Copy code
kill PIDOptions:
kill -9 PID: Forcefully terminates a process.
Package Management
27. apt-get
Manages packages on Debian-based systems (like Ubuntu).
sh Copy code sudo apt-get update sudo apt-get install package_name
28. yum
Manages packages on Red Hat-based systems (like CentOS).
sh Copy code sudo yum update sudo yum install package_name
29. dpkg
Manages Debian packages.
sh Copy code
sudo dpkg -i package_name.deb30. rpm
Manages Red Hat packages.
sh Copy code
sudo rpm -i package_name.rpmText Processing
31. head
Displays the first few lines of a file.
sh Copy code
head file_name32. tail
Displays the last few lines of a file.
sh Copy code
tail file_nameOptions:
tail -f file_name: Follows the file, displaying new lines as they are added.
33. wc (Word Count)
Counts lines, words, and characters in a file.
sh Copy code
wc file_name34. sort
Sorts lines of text files.
sh Copy code
sort file_name35. uniq
Removes duplicate lines from a sorted file.
sh Copy code
uniq file_nameArchiving and Compression
36. tar
Archives files into a tarball.
sh Copy code
tar -cvf archive_name.tar file_or_directoryOptions:
tar -xvf archive_name.tar: Extracts a tarball.
37. gzip
Compresses files.
sh Copy code
gzip file_name38. gunzip
Decompresses files.
sh Copy code
gunzip file_name.gzUser Management
39. adduser
Adds a new user.
sh Copy code
sudo adduser user_name40. passwd
Changes a user’s password.
sh Copy code
passwd user_name41. usermod
Modifies a user account.
sh Copy code
sudo usermod -aG group_name user_name42. deluser
Deletes a user.
sh Copy code
sudo deluser user_name43. whoami
Displays the current logged-in user.
sh Copy code
whoamiDisk Management
44. mount
Mounts a file system.
sh Copy code
sudo mount /dev/sdX /mnt45. umount
Unmounts a file system.
sh Copy code
sudo umount /mnt46. fsck (File System Check)
Checks and repairs a file system.
sh Copy code
sudo fsck /dev/sdXSystem Monitoring
47. uptime
Displays how long the system has been running.
sh Copy code
uptime48. dmesg (Display Message)
Displays system messages.
sh Copy
dmesg49. journalctl
Views systemd logs.
sh Copy code
sudo journalctl50. htop
Interactive process viewer.
sh Copy code
htopConclusion
This beginner Linux command cheat sheet provides a foundation to help you navigate and manage your Linux system. As you become more comfortable with these commands, you’ll be able to perform a wide range of tasks more efficiently. Remember, practice is key to mastering Linux, so don’t hesitate to experiment with these commands and explore further. Happy learning!



