Imagine an operating system so reliable that it powers the world’s biggest servers, the fastest supercomputers, and even the cloud infrastructure of leading tech companies. Welcome to Red Hat Enterprise Linux (RHEL) — the backbone of modern IT systems.
Whether you’re a complete novice exploring Linux for the first time or an experienced professional looking to brush up on your basics, you’re in the right place. This tutorial is your starting point to uncover the power, stability, and versatility of RHEL.
But what makes RHEL stand out in the crowded Linux ecosystem? Why do companies like Google, Amazon, and NASA rely on it? Let’s dive in and explore everything you need to know to begin your journey with Red Hat Enterprise Linux.
What we’ll cover:
-
A Little Backstory
-
What Makes Linux Special?
-
Why Red Hat Enterprise Linux?
-
How to Set Up Your Practice Environment for Linux Commands
-
Introduction to Basic Linux Commands
A Little Backstory
Have you ever wondered where it all began? Before there was Linux, there was UNIX, a revolutionary operating system created in the 1970s that changed the way computers worked. Designed for stability, multitasking, and scalability, UNIX became the foundation upon which modern operating systems were built.
Fast forward to 1991, when a 21-year-old Finnish computer science student named Linus Torvalds at the University of Helsinki decided to create his own operating system kernel as a hobby project. Little did he know, this hobby would evolve into Linux, a game-changing open-source operating system that would redefine the tech world.
Now here’s the fun part: how did Linux get its name? Originally, Linus wanted to call it “Freax” (a combination of “free,” “freak,” and “Unix”). But when he uploaded the project files to a server managed by his friend Ari Lemmke, Ari thought “Freax” didn’t sound appealing enough. So, without telling Linus, Ari named the directory “Linux” instead — a clever blend of Linus + Unix. And the rest, as they say, is history.
What Makes Linux Special?
Unlike traditional operating systems, Linux was open-source, meaning anyone could view, modify, and distribute the code freely. This sparked a wave of innovation, allowing developers around the world to create their own versions of Linux, tailored to different needs.
What truly sets Linux apart is the global community of developers and enthusiasts who constantly improve and innovate. This collaborative approach ensures that Linux stays at the forefront of technology, evolving with the needs of its users.
Today, Linux isn’t just one operating system — it’s an entire family of distributions (or distros). From user-friendly versions like Ubuntu and Fedora to enterprise-grade solutions like RHEL, there’s a Linux for everyone. In this article, we’ll focus on RHEL and why it’s a great choice for certain projects.
If you want to explore the fascinating variety of Linux distros, you can check out this Wikipedia page on Linux distributions to see just how diverse the Linux ecosystem is.
Why Red Hat Enterprise Linux?
Red Hat Enterprise Linux (RHEL) is like the reliable, no-nonsense friend you call when you’re organizing a big, important event.
Sure, you could ask your fun but unpredictable friends (like open-source Linux distros) to help, but there’s always a chance they’ll forget the chairs or crash halfway through the party.
RHEL, on the other hand, is built for stability and comes with a professional support team that’s on call 24/7 to fix anything that goes wrong. It’s tested thoroughly to make sure it works perfectly with all the tools and gadgets big companies use, so there are no surprises.
RHEL’s blend of reliability, security, performance, and support makes it the go-to operating system for enterprises, cementing its importance in the IT landscape.
Here’s a summary of RHEL’s benefits and features:
1. Enterprise-Grade Stability and Reliability
RHEL is designed to meet the demands of mission-critical workloads, ensuring systems run consistently and predictably. Its long lifecycle support ensures businesses can rely on it without worrying about frequent upgrades or compatibility issues. This makes it an ideal choice for applications where downtime is unacceptable.
2. Comprehensive Security Features
Security is paramount in enterprise environments, and RHEL excels with robust features such as SELinux (Security-Enhanced Linux) and regular security updates. The proactive approach to identifying and addressing vulnerabilities helps organizations comply with industry regulations and maintain the integrity of their systems.
3. Scalability and Performance Optimization
RHEL is optimized to deliver high performance for a wide range of hardware architectures and workloads, including cloud, on-premises, and hybrid setups. Its ability to scale efficiently makes it suitable for small-scale applications as well as large data centers and enterprise-grade workloads.
4. Extensive Ecosystem and Professional Support
RHEL benefits from Red Hat’s extensive ecosystem of certified hardware, software, and cloud providers. Enterprises have access to a wealth of tested and certified solutions, along with 24/7 support from Red Hat. This ensures any technical issues are resolved promptly, minimizing downtime and enhancing productivity.
How to Set Up Your Practice Environment for Linux Commands
Before we jump into learning and practising Linux commands, you’ll need to set up an environment where you can run these commands. Here are three great options to consider:
1. Using the Terminal on Your Linux Machine
If you’re already using Linux, the terminal is your go-to interface for interacting with the system. All Linux commands are executed here, and it’s the ideal environment to start practising.
You can open the terminal and directly type your commands to see them in action.
2. Using VMware or Oracle VirtualBox
If you don’t want to install Linux directly on your main machine, using a virtual machine (VM) is a great solution. Virtualization tools like VMware or Oracle VirtualBox allow you to run a full Linux distribution as a guest operating system without affecting your primary system. This way, you can experiment freely in an isolated environment.
How to use a VM:
-
Install VMware Workstation Player or Oracle VirtualBox on your computer.
-
Download the RHEL ISO Image. You can obtain the RHEL ISO by following these steps:
-
Register for a Red Hat Developer Account (it’s free):
-
Go to the Red Hat Developer Program.
-
Create an account (it’s free for individual developers).
-
After registering, sign in to your Red Hat account.
-
-
Download the ISO:
-
Visit the RHEL Download Page after logging in.
-
Choose the ISO image for RHEL (you may select the latest version).
-
Click Download and save the ISO file on your local system.
-
-
Once your VM is running, you can use it to practice commands and explore Linux.
3. KillerCoda: An Online Linux Environment
If you’re looking for an entirely online solution, KillerCoda is a fantastic option. It provides an interactive Linux terminal right in your browser, so you don’t need to install anything on your local machine.
Visit the KillerCoda website and you will see scenario-based lessons.
Now you should be all set.
Introduction to Basic Linux Commands
One of the key features that makes Linux so versatile is its command-line interface (CLI). This is where you can interact with the system by typing commands. These commands allow you to perform a variety of tasks like managing files, directories, system resources, and much more.
Now, we’ll explore some essential Linux commands that every beginner should know. These commands are simple yet powerful tools that can help you navigate and manage your Linux environment efficiently.
Basic Linux Commands
1. echo
The echo
command is used to display text or variables to the terminal. It is one of the most commonly used commands in Linux and is helpful for displaying messages, variable values, and even system information.
echo
syntax:
echo [OPTION] [STRING]
Example:
echo Hello
echo -n Hey
name="Tanishka"
echo "Hello, $name"
Option -e
allows echo commands to enable escape sequences.
Here are some other options you can use with echo
:
-
\n
– New line: Moves the output to the next line. -
\t
– Tab: Adds a tab space. -
\v
– Vertical Tab: Adds a tab as the cursor moves to the next vertical position. -
\b
– Backspace: Removes the last character. -
\\
– Backslash: Prints a backslash.
Example:
echo -e "Hello World\nThis is a new line."
echo -e "Hello World\tThis is tabbed."
echo -e "Hello\vWorld\vThis is vertically spaced."
echo -e "This is a backslash: \\"
2. whoami
The whoami
command is used to display the username of the currently logged-in user.
whoami
syntax:
whoami
Example:
whoami
3. pwd
The pwd
command is used to display the current working directory.
pwd
syntax:
pwd [OPTION]
Example:
pwd
pwd -L
pwd -P
4. ls
The ls
command is used to list the files and directories in the current working directory or specified directory.
ls
syntax:
ls [OPTION] [PATH]
Example:
ls
Here are some options you can use with ls
:
-
ls -l
: Lists detailed information about files and directories -
ls -lh
: Lists detailed information about files and directories with size in human readable format -
ls -a
: Lists all hidden files -
ls -R
: Lists recursive content of directory
5. date
The date
command is used to display or set the system date and time.
date
syntax:
date [OPTION] [FORMAT_SPECIFIER]
Example:
date
date +"%d/%m/%Y"
date +"%H:%M:%S"
date -u
date --set "2024-06-05"
date -d "yesterday"
date -d "tomorrow"
date -d "7 days"
Options you can use with the date command:
-
-u
: Displays date and time in UTC. -
-d
: Displays or sets the date/time to a specific string (e.g., “yesterday”, “7 days ago”). -
%d
: Day of the month (01 to 31). -
%m
: Month of the year (01 to 12). -
%y
: Last two digits of the year (00 to 99). -
%Y
: Full year (for example, 2025).
date -u
date -d "yesterday"
date -d "tomorrow"
date -d "7 days"
date +"%d/%m/%Y"
date +"%H:%M:%S"
6. cal
The cal
command is used to display calendar details. If no options are given, the current month is displayed.
cal
syntax:
cal [OPTIONS]
Example:
cal
cal --highlight
Options you can use with the cal
command:
-
--highlight
: Highlights the current date in the calendar. -
-3
: Displays the previous, current, and next month. -
-m
: Displays the current month in a multi-line format. -
-y
: Displays the calendar for the entire year. -
-A [N]
: Displays N months ahead of the current month. -
-B [N]
: Displays N months before the current month. -
cal [year]
: Displays the calendar for the entire year. -
cal [month] [year]
: Displays the calendar for the specified month and year.
cal 2024
cal 06 2024
cal -m
cal -A 3
cal -B 2
7. nl
The nl
command is used to add line number to file content.
nl
syntax:
nl [OPTIONS] [FILENAME]
Example:
nl file.txt
nl -b a file.txt
nl -b t file.txt
nl -s ') ' file.txt
As you can see in the code above, there are other options you can use with the nl
command, too.
File Creation and Handling Commands
1. touch
The touch
command is used to create an empty file or update the last modified time if a file exists.
touch
syntax:
touch [OPTIONS] [FILENAME]
Example:
touch file.txt
touch file1.txt file2.txt file3.txt
touch file{1..10}.txt
2. cat
The cat
command concatenates files and also displays the content of files.
cat
syntax:
cat [OPTIONS] [FILENAME]
Example:
cat file.txt
cat file1.txt file2.txt > merged.txt
cat file1.txt >> file2.txt
cat -n file.txt
cat > file.txt OR cat >> file.txt
Directory Creation and Handling
1. mkdir
The mkdir
command is used to create a directory.
mkdir
syntax:
mkdir [OPTIONS] [DIRECTORYNAME]
Example:
mkdir folder
mkdir fol1 fol2 fol3
mkdir fol{1..10}
mkdir -p /myData/data
ls -R /myData
mkdir -v fol1 fol2 fol3
2. cd
The cd
command is used to change the directory – that is, to navigate between directories.
cd
syntax:
cd [DIRECTORY]
Example:
cd myFolder
cd /home/myFolder
cd ..
cd ../..
cd OR cd ~
cd -
Copy, Move, and Remove Files and Directories
1. cp
The cp
command is used to copy files and directories from one location to another.
cp
syntax:
cp [OPTIONS] [SOURCE] [DESTINATION]
Example:
cp myFile.txt /home/newFolder
cp myFile1.txt myFile2.txt /home/newFolder
cp -r oldData /home/newData
cp -i file.txt /home/Folder
cp -v oldData /home/newData
cp -f file.txt /newFolder
2. mv
The mv
command is used to move files and directories from one location to another. It is also used to rename a file or a directory.
mv
syntax:
mv [OPTIONS] [SOURCE] [DESTINATION]
Example:
mv myFile.txt /home/newFolder
mv myFile1.txt myFile2.txt /home/newFolder
mv -i file.txt /home/sample
mv -v oldData /home/sample
mv oldFile.txt newFile.txt
3. rm
The rm
command is used to remove files and directories.
rm
syntax:
rm [OPTIONS] [FILENAME OR DIRECTORYNAME]
Example:
rm file.txt
rm file1.txt file2.txt
rm emptyDir
rm -r myData
rm -r -i myData
rm -r -f myData
rm -r -f -v myData
4. rmdir
The rmdir
command is used to remove empty directories only.
rmdir
syntax:
rmdir [OPTIONS] [FILENAME OR DIRECTORYNAME]
Example:
rmdir emptyDir
rmdir myDir1 myDir2 myDir3
rmdir myDir
Final Words
Congratulations! You’ve successfully learned the basics of Red Hat Enterprise Linux (RHEL) and the essential commands that form the foundation of Linux systems.
Keep practicing these commands, and soon they’ll become second nature to you. Mastery comes with repetition, so continue experimenting and applying these fundamentals in real-world scenarios.
Stay tuned for more articles. Get ready to take your RHEL skills to the next level.
Let’s connect!