Top 50+ Must-Know Linux Commands for Beginners [2025 Updated Cheat Sheet]
Master Linux basics with this updated 2025 cheat sheet of essential Linux commands. From file management to networking and user controls — perfect for students, admins, and cybersecurity learners.
![Top 50+ Must-Know Linux Commands for Beginners [2025 Updated Cheat Sheet]](https://s3.ap-south-1.amazonaws.com/webasha-blog/uploads/images/202506/image_750x_6856662ee56d2.webp)
If you're new to Linux or preparing for a system admin, cybersecurity, or DevOps role, mastering basic Linux commands is essential. Linux is a powerful, open-source operating system widely used across servers, embedded systems, and developer environments. The command line interface (CLI) remains one of the most efficient ways to interact with a Linux system.
In this guide, we’ve compiled all the must-know Linux commands, grouped by functionality, to help you build a strong foundation and boost your productivity.
Navigation & Filesystem
These commands help you explore and navigate the Linux directory structure.
-
pwd
: Print the current working directory path. -
ls
: List directory contents. -
cd [dir]
: Change directory to the specified path. -
tree
: Visualize directory structure as a tree. -
find [path] -name [file]
: Search for files by name in a directory path.
File Operations
Use these commands to manage files—create, delete, copy, and move them.
-
touch [file]
: Create an empty file. -
rm [file]
: Remove/delete a file. -
rm -r [dir]
: Recursively delete a directory and its contents. -
cp [src] [dest]
: Copy files or directories. -
mv [src] [dest]
: Move or rename files or directories.
File Viewing
Quickly display file contents or monitor logs with these commands:
-
cat [file]
: View entire file contents. -
less [file]
: View large files one screen at a time (scrollable). -
head -n 10 [file]
: Show the first 10 lines of a file. -
tail -n 10 [file]
: Show the last 10 lines of a file. -
tail -f [file]
: Continuously display a file’s last lines (used for logs).
File Permissions
Linux controls access to files through permission settings.
-
umask
: Displays or sets the default permission mask. -
stat [file]
: Displays detailed file metadata including permissions. -
chmod [mode] [file]
: Changes file permissions (e.g.,chmod 755 file.sh
). -
chown [user]:[group] [file]
: Changes file owner and group.
Process Management
Manage running tasks and monitor resource usage with these commands.
-
ps aux
: Shows all running processes. -
top
: Displays dynamic, real-time process view. -
htop
: Enhanced process viewer (interactive). -
kill [PID]
: Kill a specific process using its ID. -
killall [name]
: Kill all processes by name.
Networking
Monitor, troubleshoot, and configure your network connections.
-
ip a
: View all IP addresses. -
ping [host]
: Check network connectivity. -
host [domain]
: Get DNS information for a domain. -
dig [domain]
: Advanced DNS querying tool. -
netstat -tuln
: View open ports and active connections.
Disk & Storage
Disk space, partitions, and filesystem management.
-
df -h
: Display disk usage in human-readable format. -
du -sh [dir]
: Show total size of a directory. -
lsblk
: List block devices (disks, partitions). -
fdisk -l
: Display disk partition tables. -
mount / umount
: Mount or unmount file systems.
User Management
Add, delete, and manage users and groups.
-
whoami
: Display the current user. -
id [user]
: Show user ID and group IDs. -
adduser [name]
: Add a new user. -
passwd [user]
: Change a user’s password. -
groups [user]
: Display all groups a user belongs to.
System Information
Learn about your Linux environment and kernel.
-
uname -a
: Show system and kernel information. -
uptime
: Display system uptime. -
free -h
: Show available and used memory. -
dmesg
: Display kernel-related messages (hardware boot logs).
Search & Text Processing
Powerful tools to filter, search, and process data in files.
-
grep '[pattern]' [file]
: Search for pattern matches in files. -
awk '{print $1}' [file]
: Process and print specific fields in text files. -
cut -d: -f1 [file]
: Cut and display specific fields using a delimiter. -
sort [file]
: Sort lines alphabetically or numerically. -
uniq [file]
: Remove duplicate lines. -
wc -l [file]
: Count the number of lines in a file.
Bonus Tip: Combine Commands with Pipes |
You can chain multiple commands using pipes. For example:
ps aux | grep firefox
This command lists all processes and filters those related to Firefox.
Conclusion
Whether you're managing servers, analyzing logs, or learning cybersecurity, these commands are essential for mastering Linux. Familiarity with these tools will greatly improve your efficiency and confidence in the terminal.
FAQ
What is the pwd
command used for in Linux?
The pwd
command prints the current working directory.
How do I list files and folders in Linux?
Use the ls
command to list directory contents.
How do I change directories in Linux?
Use the cd [directory]
command to move to another directory.
What does the tree
command do?
The tree
command shows the directory structure in a tree-like format.
How can I find a file by name in Linux?
Use find [path] -name [file]
to search for files by name.
How do I create an empty file in Linux?
Use the touch [file]
command to create a blank file.
How can I delete a file or folder?
Use rm [file]
to delete a file and rm -r [dir]
to delete a directory.
How do I copy files or folders?
Use cp [src] [dest]
to copy files and cp -r [dir] [dest]
to copy directories.
How do I move or rename files?
Use the mv [src] [dest]
command.
How do I display the contents of a file?
Use cat [file]
to show file contents.
How can I scroll through a file?
Use less [file]
to scroll up and down through a file.
How do I view just the first few lines of a file?
Use head -n 10 [file]
to display the top 10 lines.
How do I display the last 10 lines of a file?
Use tail -n 10 [file]
.
How do I keep monitoring the file output?
Use tail -f [file]
to view live updates.
What is the command to list running processes?
Use ps aux
to list all running processes.
How can I monitor system activity live?
Use top
or htop
for a live view of system usage.
How do I stop a process using its PID?
Use kill [PID]
or killall [name]
to stop by name.
How can I see disk usage?
Use df -h
to see human-readable disk usage.
How do I check the size of a directory?
Use du -sh [dir]
.
How do I check block device details?
Use lsblk
or fdisk -l
.
How do I mount or unmount a file system?
Use mount
or umount
with the path.
How can I check system info?
Use uname -a
for kernel/system info, or uptime
for load average.
How do I check RAM usage?
Use free -h
to view memory usage.
How can I check boot and hardware logs?
Use dmesg
.
How do I see current user info?
Use whoami
.
How do I add a new user?
Use adduser [name]
.
How do I remove a user?
Use userdel [name]
.
How do I change a user's password?
Use passwd [user]
.
How can I search text in files?
Use grep 'pattern' [file]
to find matching text.
How do I sort and count results in a file?
Use sort
, uniq
, and wc
commands for text analysis.