At first glance, typing commands into a black-and-white terminal
window might feel a little intimidating — especially when you’re used to
clicking your way through menus and folders. But once you get the hang of it,
the terminal becomes one of the most powerful, efficient, and even enjoyable
tools at your fingertips.
These days, terminal commands aren’t just for hardcore Linux fans.
Thanks to tools like WSL on Windows, macOS’s built-in terminal, and container
tech like Docker, command-line skills are useful everywhere.
Whether you're trying out Red Hat Enterprise Linux on a
free 60-day trial or just curious about what the terminal can do, here are 20
Linux commands that can level up your workflow — no matter your experience
level.
1.
Change directory (cd)
Outside of a terminal, you click on icons to move from one
folder to another, but in the terminal, you use cd. The cd command, which
stands for change directory, is
how you move through a Linux system. It's the fastest and most direct route
from one place to another.
For instance, on the desktop, when you want to move
from your home directory to a folder called presentations, then you might first have to open your Documents folder,
then open a folder called work, then a projects folder, and then the conference folder, and finally the presentations folder, which contains your exciting LibreOffice Impress
slideshow. That's a lot of double-clicking. It may also be a lot of moving
around on the screen, depending on where new windows appear, and a lot of
waypoints for your brain to track. Many people circumvent this seemingly minor
task by keeping everything on their desktop.
Terminal users avoid this issue by just typing:
|
$ cd ~/Documents/work/projects/conference/presentations |
Experienced terminal users don't even bother typing
all of that. They use the tab key to autocomplete the words for them. And
sometimes, you don't even have to resort to autocompletion. You can use
wildcards instead:
|
$ cd ~/Doc*/work/*/conf*/p* |
2. Print working
directory (pwd)
After you've clicked into a few folders on a
desktop, it's easy to forget how you got to where you are. It's no different in
the terminal. It only takes a few cd commands to become dizzyingly
disoriented. When that happens, use the pwd command.
The pwdstands for print working directory,
and that's exactly what it does. The --physical (or just -P in
some implementations) shows your location with any shortcuts (also called an
"alias" or "symlink") resolved.
|
$ pwd /home/tux/presentation $ pwd --physical /home/tux/Documents/work/projects/conference/presentations |
3. Get filetype (file)
Use the filecommand when you need to know what
type of data a file contains:
|
$ file example.foo example.foo: RIFF (little-endian) data, Web/P
image [...] $ file example.bar example.bar: ELF 64-bit LSB executable, x86-64
[...] |
The file command isn't magic, of course.
It only reports based on how a file identifies itself, and files can be wrong,
corrupted or disguised. A rigorous inspection with hexdump provides
more certainty, but for casual use, the file command is convenient.
4. Get URL (curl)
The curl command is a non-interactive
web browser for your terminal. It's a development tool for web
and API developers. It's a complex command for its flexibility, but it's worth
learning if you want to interact with network services from your terminal
smoothly.
5. View file contents
(cat)
The cat command is short for concatenate,
and it was very useful once for joining files that had been split (with a
command intuitively called split) into several small files due to size
limitations. Today, cat is mostly used as a way to dump the contents
of a text file into your terminal for quick reference, unless you use head, tail, more,
or less for that.
Despite its almost deprecated original purpose, and
despite that several other commands also perform its secondary function, cat is
still a useful utility. For instance, it can be a stand-in for the copy (cp)
command:
|
$ cat myfile.ogg > /backups/myfile.ogg |
It can reveal inconvenient invisible characters in
files. The tab character, which breaks YAML, shows up as ^Iwith
the --show-tabs option:
|
$ cat --show-tabs my.yaml --- - hosts: all tasks: - name:
Make sure the current version of 'sysstat' is installed. dnf: name: ^I- sysstat ^I- httpd ^I- mariadb-server state:
latest |
It can show non-printing characters with
--show-nonprinting, mark the ends of lines with --show-ends, provide line
numbers with --number, and more.
6. Find a file (find)
The find command helps you find files, but
thanks to its many options, it can help you find files with a variety of
filters and parameters.
And in case you've been wondering why the most
fundamental command of all, the humble ls command, isn't on this list,
it's because of the flexibility of find. Not only can find list files:
|
$ find . /bar.txt ./baz.xml ./foo.txt [...] |
It can also provide long listings:
|
$ find . -ls 3014803 464
-rw-rw-r-- 1 tux users 473385 Jul 26 07:25 ./foo.txt 3014837 900
-rwxrwxr-x 1 tux users 918217 Nov
6 2019 ./baz.xml 3026891 452
-rw-rw-r-- 1 tux users 461354 Aug 10 13:41 ./foo.txt [...] |
It's a technicality, but a neat trick to know.
RHCSA.GURU Linux
commands cheat sheet blog
7. Archive (tar)
The tar file format, combined with a
compression tool (such as gzip), is a common way to produce a compressed
archive similar to the way the ZIP tool works. To unarchive a tar file:
$ tar --extract --file example.tar.gz
You can create your own tar file:
$ tar --create --gzip --file example.tar.gz example
8. Archive (zip)
Much of the world uses the ZIP format for
compression. You can zip and unzip archives from the terminal, or even just
browse an archive without unzipping.
To list the files in an archive without unzipping
it, use the -l (for "list") option with the unzip command:
$ unzip -l example.zip
To unzip an archive, just use the unzip command:
$ unzip example.zip
To create your own archive, you must specify what
you want the name of your archive to be, and then use the -r option
(for "recursive") to tell the terminal what folder you want it to
compress:
$ zip example.zip -r example
9. View contents of a
file (more, less, and most)
A pager is like the catcommand, except it
pauses the output of a file at the bottom of your screen until you scroll down
for more. It's a simple application, but there's nuance to each implementation.
Do you scroll with arrow keys or the spacebar? Do you have to quit manually, or
does the pager exit at the end of the file it's displaying? What's your
preferred search behavior?
Try more, less, and most commands
and see which one is your favourite.
10. Open a secure shell
(ssh)
OpenSSH not only helps secure connections to remote
systems (including virtual machines), it also enables other commands. For
instance, for many users, it's their .ssh directory that makes it possible
for them to interact smoothly with Git repositories, post updates to a website
or log in to their cloud's control plane.
Using SSH directly is simple. You provide your
username as it appears on the remote system, and the IP address (or
fully-qualified domain name) of that system, and you have a secure connection.
$ ssh tux@10.0.0.33
Setting up secret SSH keys for services like GitHub
and GitLab uses a related command, ssh-keygen. This prompts you for some
preferences (it's safe to accept the defaults), and then generates a key for
you. You must never share your secret key, but what you do with the public key
(the file ending in .pub) depends on the Git host you're using. Generally,
you just copy the contents of the public key file and paste it into a
configuration panel of the Git host. You already know the command to view the
contents of your public SSH key. It's the catcommand:
$ cat ~/.ssh/id_rsa.pub
11.
Move and rename a
file (mv)
The mv command does double-duty: It
both moves files and it renames files. It has several available
safeguards, including --interactive and --no-clobber options
to avoid clobbering an existing file, a --backup command to preserve
until it is verified at its new location, and the --update option to
ensure that an older version doesn't replace a newer file.
12.
Elevate permissions
(sudo)
When you have a single user with a known user name
and all the privileges on a system, that user quickly becomes
the target of attacks. By eliminating the need for a literal root user,
the sudocommand elegantly removes important information about your system
from general knowledge. That's not all it does, though. With sudo, you can
easily manage privileges down to individual commands, users, and groups. You
can enable password-less execution of select commands, record user sessions,
verify commands with digest validation and more.
13.
Install software
(dnf)
On Red Hat Enterprise Linux (RHEL), the dnf command
installs software and can update all software on the system. For desktop
applications, you can also use the Software application,
but dnf is essential for installing commands with no graphical
component.
To search for a command by name, use the search keyword.
For example, to search for tcpdump:
$ sudo dnf search tcpdump
To install:
$ sudo dnf install tcpdump
14.
Create a command
alias (alias)
Turn long commands into easy-to-remember shortcuts
by using the alias command:
|
$ alias ls='ls --classify --almost-all
--ignore-backups --color' |
15.
Clear screen (clear)
Sometimes your terminal gets cluttered. There's
nothing like a nice, fresh screen after typing clear (or pressing
Ctrl+L in some shells).
16.
Search the contents
of a file (grep)
The grep command is so ubiquitous that
it's often used as a verb ("I'll grepthrough some files") and a
gerund ("grepping some output"). It's a key component when
parsing text in your shell, whether you're looking through log files or parsing
the output of some other command. It's a way for the busy user to focus on
specific information.
To search for a word in a text file using grep:
$ grep Linux example.txt
To see the line number of where the word occurs, use
the --line-number option:
$ grep --line-number Linux example.txt
17.
Search for a process
ID (pgrep)
Managing your system's resources is mostly up to the
kernel. However, when you prefer or require a manual approach, there's
the pgrep command. Using pgrep, you can get the process ID of a
running application or command:
|
$ pgrep firefox |
18.
Create an Access
Control List (setfacl)
Traditionally, POSIX file permissions were
determined by chown and chmod. Systems have become more complex,
though, so there's a command to provide a little more flexibility. The setfacl command
lets you create an Access Control List, granting permissions to arbitrary
users and setting default permissions for folders and the contents created within
them.
RHCSA.GURU Access Control
List
19.
Network tests
(netcat)
Not every user needs netcat (nc), but few who use it
ever want to give it up. The nc command is an all-purpose network
connection tool.
It can connect to a port, similar to telnet:
|
$ nc -u 192.168.0.12 80 |
It can ping
a port, similar to ping:
|
$ nc -zvn 192.168.0.12 25 |
It can probe
for open ports, similar to nmap:
|
$ nc -zv 192.168.0.12 25-80 |
And that's
just a small sample.
20.
You- Build your own
commands
Once you have picked up few of these commands you
can start combining them into scripts and creating your own shortcuts. Once you
learn building blocks, you can start designing your own tools.
Conclusion
Mastering these 20 Linux commands can
significantly boost your confidence and productivity as a system administrator.
Whether you're managing files, automating tasks, or troubleshooting systems,
these tools form the backbone of efficient Linux operations.
But remember — knowing the commands is just
the beginning. Real expertise comes from practice, real-world
problem-solving, and guided mentorship.
If you're preparing for the Red Hat
Certified System Administrator (RHCSA) exam — or just want to become a true
Linux pro — then it's time to join RHCSA Guru.
🔥 What You Get with RHCSA Guru:
· Hands-on
labs with real-world scenarios
· Step-by-step
video lessons
· Cheat
sheets and command references
· One-on-one
mentorship and support
· Mock exams
and exam strategy tips
✅ Trusted by thousands of students.
✅ Perfect for beginners and career switchers.
✅ Lifetime access to all updates.
Start your RHCSA journey today at RHCSA.GURU