Welcome to the heart of Linux: the terminal. For many new users, this black window filled with text is the most intimidating part of the Linux experience. But here’s the secret: it’s also the most powerful. The command line is not obsolete; it’s the most efficient, direct, and flexible way to control your computer.
Learning the terminal isn’t about memorizing hundreds of commands. It’s about building a foundation. Once you understand the basic logic, you unlock the ability to automate tasks, fix problems, and manage your system in ways a graphical interface simply can’t match.
This guide is designed for the absolute beginner. We will walk you through the 10 basic Linux terminal commands that form the foundation of everything that follows. Mastering these will transform you from someone who uses Linux to someone who controls it.
Getting Started: The Basics of Navigation
First, let’s learn how to look around. These commands are the equivalent of opening folders and looking at files in a graphical file manager.
1. ls (List)
What it does: The ls command lists the files and directories in your current location. It’s the first thing you’ll type when you open a terminal to get your bearings.
Common Examples:
ls- The most basic form. It lists all non-hidden files and folders in your current directory.
ls -l(long format)- This gives you a detailed list. You’ll see permissions (like
drwxr-xr-x), the owner, the file size, and the last-modified date.
- This gives you a detailed list. You’ll see permissions (like
ls -a(all)- This shows all files, including hidden ones. Hidden files in Linux start with a dot (e.g.,
.bashrc).
- This shows all files, including hidden ones. Hidden files in Linux start with a dot (e.g.,
ls -lha(Our Recommendation)- This is a popular combination:
lfor long format,hfor “human-readable” (it shows sizes like10Kor5Minstead of10240), andafor all files.
- This is a popular combination:
2. cd (Change Directory)
What it does: The cd command is used to move between directories (folders). This is how you navigate your system’s file structure.
Common Examples:
cd Documents- Moves you from your current location into the
Documentsdirectory. (Remember: the terminal is case-sensitive!)
- Moves you from your current location into the
cd ..- Moves you up one directory level.
cd(orcd ~)- This is a shortcut that instantly takes you back to your “home” directory (e.g.,
/home/username) from anywhere.
- This is a shortcut that instantly takes you back to your “home” directory (e.g.,
cd /var/log- This uses an “absolute path,” starting from the root (
/) of the filesystem, to jump directly to thelogdirectory, no matter where you are.
- This uses an “absolute path,” starting from the root (
Pro-Tip: Use the Tab key for auto-completion. If you type cd Doc and press Tab, the shell will automatically complete it to cd Documents/ as long as it’s the only match. This is the single most important time-saving trick.
Managing Files and Directories
Now that you can move around, let’s learn how to create, copy, move, and delete files.
3. cp (Copy)
What it does: The cp command copies files or directories.
Common Examples:
cp my_file.txt my_file_copy.txt- Copies
my_file.txtand creates a new file namedmy_file_copy.txtin the same directory.
- Copies
cp my_file.txt Documents/- Copies
my_file.txtfrom your current location into theDocumentsdirectory.
- Copies
cp -r MyFolder MyFolderCopy- To copy a directory, you must use the
-r(recursive) flag. This copies the folder and everything inside it.
- To copy a directory, you must use the
4. mv (Move / Rename)
What it does: The mv command has two functions: it moves files and it renames them. The logic is the same: you’re just “moving” the file to a new name.
Common Examples:
mv old_name.txt new_name.txt- This renames the file.
mv my_file.txt Downloads/- This moves
my_file.txtinto theDownloadsdirectory, keeping its name.
- This moves
mv my_file.txt Downloads/new_name.txt- This moves the file and renames it in one step.
5. rm (Remove)
What it does: The rm command deletes files and directories. This is one of the most powerful and dangerous essential Linux commands.
CRITICAL WARNING:
rmis permanent. There is no “Recycle Bin” or “Trash” on the command line. Once yourma file, it is gone forever. Always double-check your command before pressing Enter.
Common Examples:
rm my_file.txt- Deletes the file
my_file.txt.
- Deletes the file
rm -i my_file.txt- The
-i(interactive) flag is safer. It will prompt you for confirmation (rm: remove regular file 'my_file.txt'?) before deleting. This is highly recommended for Linux commands for beginners.
- The
rm -r MyFolder- To delete a directory (and everything in it), you must use the
-r(recursive) flag. This is also very dangerous. Be 100% sure you are in the right place.
- To delete a directory (and everything in it), you must use the
What is CachyOS? The Performance-Optimized Arch Distro Explained
Finding & Monitoring Your System
These commands help you find information and see what your computer is doing.
6. grep (Global Regular Expression Print)
What it does: grep is a powerful search tool. It reads the content of files and looks for lines that match a specific text pattern.
Common Examples:
grep "error" /var/log/syslog- Searches the system log file for any line containing the word “error.” This is invaluable for troubleshooting.
grep -i "hello" my_file.txt- The
-iflag makes the search case-insensitive. It will find “hello”, “Hello”, or “HELLO”.
- The
grep -r "my_function" ./Project- The
-r(recursive) flag searches for the text “my_function” in all files inside theProjectdirectory.
- The
7. top (Table of Processes)
What it does: top is a real-time system monitor. It’s the command-line equivalent of the Windows Task Manager or macOS Activity Monitor.
Common Examples:
top- Simply type
topto open the full-screen interface. You will see a live-updating list of all running processes, sorted by CPU usage. It also shows your system’s uptime, memory (RAM) usage, and more. - To exit the
topscreen, simply press theqkey.
- Simply type
Pro-Tip: While top is classic, many users prefer htop, a more modern, colorful, and user-friendly version. You can install it on Fedora with sudo dnf install htop and run it by typing htop.
Power and Permissions: The Final Step
These last three commands are the key to managing your system, getting help, and performing administrative tasks.
8. chmod (Change Mode)
What it does: chmod changes the permissions (read, write, execute) of a file or directory. Its most common use for beginners is making a script or program “executable.”
Common Examples:
chmod +x my_script.sh- You just downloaded a script (
.shfile) or a program (like an AppImage). You try to run it, but get “Permission denied.” - This command adds the “executable” permission (
+x), allowing you to run it with./my_script.sh.
- You just downloaded a script (
9. sudo (Superuser Do)
What it does: sudo is one of the most important commands. It stands for “Superuser Do” and allows you to run a single command with administrative (or “root”) privileges.
Common Examples:
sudo dnf install gimp- You cannot install software as a regular user.
sudotemporarily elevates your privileges to run thednf installcommand as root (on Fedora/RHEL). On Debian/Ubuntu, this would besudo apt install gimp.
- You cannot install software as a regular user.
sudo nano /etc/hosts- System configuration files (like
/etc/hosts) are protected. You can read them as a normal user, but to edit them, you must usesudo.
- System configuration files (like
Warning: Like
rm,sudois powerful. Never type asudocommand unless you understand exactly what it does. Running a malicious command withsudocan destroy your entire system.
10. man (Manual)
What it does: The man command is the most important command to learn. It is the built-in help system. It gives you the “manual page” for any other command.
Common Examples:
man ls- This opens the complete manual for the
lscommand, showing you every flag (like-l,-a,-h) and what it does.
- This opens the complete manual for the
man grep- Want to know more about
grep? This is the place. - To navigate the
manpages, use the Up/Down arrow keys. To exit, press theqkey.
- Want to know more about
Conclusion: Your Journey Has Just Begun
You’ve just learned 10 commands, but you’ve unlocked thousands. The terminal is a language. By learning ls and cd, you’ve learned to see and move. With cp, mv, and rm, you can manipulate your world. With grep and top, you can inspect it. And with chmod, sudo, and man, you have the power to change it and the wisdom to learn more.
Final Warning: Use Power Responsibly
Commands like
rmandsudoare not to be trifled with. They offer ultimate control, which includes the control to break things. Always think before you press Enter. Using these commands is at your own risk.
💬 What’s the command-line trick you wish you’d learned sooner? What command should be #11 on this list? Share your thoughts and questions in the comments below!

