The Linux command line can feel like a foreign language the first time you encounter it. But like any language, it becomes familiar with practice — and the good news is that a surprisingly small vocabulary gets you surprisingly far. Master these ten commands and you will have the foundation to navigate, manage, and work within any Linux system with real confidence. Each one is a building block. Together, they unlock the terminal.
The ls command is almost certainly the first command you will ever run on a Linux system.
It lists the contents of a directory — the files and subdirectories inside it — so you can see what is
there. On its own, ls shows a simple list of names in the current directory. But its real
power comes with flags. The combination ls -la is one of the most used commands in Linux
daily work: the -l flag switches to a detailed long format that shows file permissions,
ownership, file size, and last-modified date, while the -a flag reveals hidden files
(those whose names begin with a dot). Getting into the habit of running ls -la whenever
you enter a new directory gives you an instant, complete picture of what you are working with.
ls
ls -la
ls -l /var/log
If ls tells you what is in a directory, cd is how you move into it. Short for
"change directory," cd followed by a path moves your working location to that path.
You can use absolute paths starting from the root of the filesystem — for example,
cd /var/www/html — or relative paths based on where you currently are. Two special
shortcuts are worth memorising immediately: cd .. moves you up one level to the parent
directory, and cd ~ takes you straight back to your home directory no matter where you
are. Running cd with no argument at all also returns you home. These shortcuts make
navigating deep directory trees much faster than typing full paths every time.
cd /etc/nginx
cd ..
cd ~
cd
When you are moving around the filesystem, it is easy to lose track of exactly where you are — especially
in deep or complex directory structures. The pwd command solves this instantly by printing
the full absolute path of your current working directory. It is a short command with no flags needed for
everyday use, and it is one you will reach for constantly, particularly when writing scripts or
troubleshooting. Many terminal setups display the current directory in the prompt itself, but
pwd gives you the unambiguous full path that you can copy and use elsewhere. Knowing your
location in the filesystem is a fundamental habit for anyone working at the command line.
pwd
Creating new directories is an everyday task, and mkdir is how you do it. The basic form
is simply mkdir foldername, which creates a new directory with that name inside your
current location. Where mkdir becomes especially useful is with the -p flag,
which stands for "parents." Using mkdir -p nested/path/here creates the entire chain of
directories in a single command, even if none of them exist yet. Without -p, trying to
create a directory inside a non-existent parent would produce an error. This flag is particularly
handy when setting up project directory structures or preparing environments with scripts.
mkdir projects
mkdir -p projects/website/assets/images
The rm command removes files permanently. Unlike moving something to a recycle bin, deletion
in Linux is immediate and not easily reversible, so this is a command that deserves your full attention
before you press Enter. In its basic form, rm filename deletes a single file. To delete a
directory and everything inside it, you need the -r flag, which stands for recursive:
rm -r directoryname. You will sometimes see the combined flag rm -rf used in
tutorials; the -f adds "force," which suppresses any confirmation prompts. This combination
is powerful and unforgiving — it will delete everything you point it at, immediately, without asking.
Always double-check your path before using -rf, especially if you are running as root.
rm old-file.txt
rm -r old-folder
rm -rf /tmp/build-cache
To copy a file from one location to another, use cp. The basic syntax is
cp source destination, where source is the file you want to copy and destination is where
you want the copy to go. If you provide a directory as the destination, the copy is placed inside that
directory with its original name. If you provide a full file path as the destination, the copy is
created with that exact name. To copy an entire directory along with all of its contents, add the
-r flag for recursive operation: cp -r sourcedir destdir. This is essential
when backing up directories or duplicating project structures. The original file is always preserved;
cp makes a new independent copy.
cp config.txt config-backup.txt
cp -r myapp/ myapp-backup/
cp report.pdf /home/user/Documents/
The mv command does double duty: it moves files and directories from one location to
another, and it renames them. The syntax is the same in both cases — mv source destination
— but the effect depends on the destination. If you specify a path in a different directory as the
destination, the file is moved there. If you specify a new name in the same directory, the file is
renamed. If you specify a path in a different directory with a new filename at the end, the file is
moved and renamed in a single step. Unlike cp, mv does not leave the original
behind — after the operation, the file exists only in its new location under its new name.
mv draft.txt final.txt
mv final.txt /home/user/Documents/
mv old-name.sh /scripts/new-name.sh
The name cat comes from "concatenate," but in practice the command is most commonly used
to display the contents of a file directly in the terminal. Running cat filename prints
the entire file to standard output, which is useful for short files, configuration files, and log
snippets. For longer files, you would typically reach for less instead, but
cat is faster for a quick look. Its concatenation capability becomes useful when you pipe
its output into another command — for example, cat access.log | grep "404" feeds the
contents of a log file into grep to search for error lines. This kind of command chaining
is one of the defining strengths of working in a Linux shell.
cat /etc/hosts
cat server.log | grep "ERROR"
cat file1.txt file2.txt > combined.txt
Once you are dealing with files of any significant size — logs, configuration files, source code —
being able to search them efficiently becomes essential. grep is the Linux tool for
this. It searches the contents of a file (or multiple files) for lines that match a given pattern
and prints those lines to the terminal. The basic form is grep "pattern" filename.
The -r flag makes the search recursive, scanning all files within a directory and its
subdirectories: grep -r "search term" /path/to/dir. The -i flag makes
the match case-insensitive. The -n flag adds the line number to each result. grep
supports full regular expressions, giving it enormous flexibility for complex search patterns. It is
one of the most used commands in real-world Linux work.
grep "error" /var/log/syslog
grep -r "TODO" ./src/
grep -in "failed" access.log
Linux uses a permission system to control who can read, write, or execute each file. Every file has
three sets of permissions: one for the file's owner, one for the owner's group, and one for everyone
else. Each set can include three permissions: read (r), write (w), and
execute (x). The chmod command changes these permissions. You can use
symbolic notation like chmod u+x script.sh to add execute permission for the owner, or
numeric (octal) notation where each permission set is represented by a digit. In the numeric system,
read is 4, write is 2, and execute is 1. Adding them gives you a digit for each set: chmod 755
means the owner has full permissions (4+2+1=7), while group and others can only read and execute
(4+0+1=5). Getting comfortable with chmod is essential for scripting, deploying
applications, and managing server security.
chmod +x deploy.sh
chmod 755 /var/www/html
chmod 644 config.env
These ten commands are your foundation. Every experienced Linux user and every professional working in DevOps, cloud infrastructure, or system administration uses them every single day. Once they become second nature to you, you will find that the command line feels less like an obstacle and more like a power tool. The next step is to keep building on this foundation — and the Learn Linux Command & Prompt app is designed to do exactly that, walking you through hundreds of commands and concepts in a structured, practical format you can carry with you everywhere.