Understand and Use Essential Tools
πRed Hat Certified System Administrator (RHCSA β EX200)
1. What is a Shell Prompt?
In Linux, the shell is a program that lets you interact with the operating system. Think of it as the interface where you type commands to make the system do tasks like:
- List files
- Copy or move files
- Check system status
The shell prompt is where you type these commands. A typical shell prompt looks like:
[user@hostname ~]$
userβ the username you are logged in ashostnameβ the name of the system~β your current directory (here it means your home directory)$β indicates a normal user (if it is#, it means root user)
Important: For RHCSA, you must be comfortable working both as a regular user and as root (administrator) using the shell.
2. Accessing a Shell Prompt
You can access a shell in several ways:
- Locally on the system:
- Login to a Linux system via GUI and open Terminal.
- The terminal opens a shell session.
- Remotely using SSH (Secure Shell):
- Command to connect from another machine:
ssh username@ip_address - Example:
ssh alice@192.168.1.100
- Command to connect from another machine:
- Switching to root (administrative user):
- Using
su(switch user):su -Then enter the root password. - Or using
sudo(execute commands as root):sudo commandExample:sudo yum update
- Using
Tip: RHCSA exam often requires running commands with root privileges, so knowing
suandsudois essential.
3. Issuing Commands
3.1 Basic Command Structure
A Linux command typically has this format:
command [options] [arguments]
- command β the program or utility you want to run (e.g.,
ls,cat) - options β modify the behavior of the command (e.g.,
-l,-a) - arguments β the target of the command (file, directory, user, etc.)
Example:
ls -l /etc
lsβ list files-lβ show detailed info/etcβ directory to list
3.2 Commonly Used Commands for the Exam
Here are essential commands you must know:
| Command | Purpose | Example |
|---|---|---|
pwd | Print current directory | pwd β /home/alice |
ls | List files | ls -l /var/log |
cd | Change directory | cd /etc |
cat | View file content | cat /etc/passwd |
more / less | View large files page by page | less /var/log/messages |
cp | Copy files | cp file1.txt /tmp/ |
mv | Move or rename files | mv file1.txt file2.txt |
rm | Remove files | rm file1.txt |
mkdir | Create a directory | mkdir /tmp/testdir |
rmdir | Remove empty directory | rmdir /tmp/testdir |
touch | Create an empty file | touch /tmp/file1 |
echo | Display text | echo "Hello" |
man | Show manual page | man ls |
uname | Show system info | uname -a |
whoami | Show current user | whoami |
RHCSA Exam Tip: You need to type commands correctly. Even small mistakes in syntax (like missing a space) can cause failure.
3.3 Understanding Options and Arguments
- Single-dash options (short options):
ls -l - Double-dash options (long options):
ls --human-readable
Remember: Many commands combine multiple options:
ls -la /etc
-lfor long listing,-ato show hidden files
3.4 Command Execution Rules
- Commands are case-sensitive.
lsβLS
- Commands must be typed in the correct order: command β options β arguments
- Use Tab completion to save time:
- Start typing a filename or directory and press
Tabto auto-complete
- Start typing a filename or directory and press
- Use Up/Down arrows to recall previous commands
4. Viewing Command Output and Errors
- Normal output β standard output (stdout)
- Errors β standard error (stderr)
Example:
ls /nonexistent
Output:
ls: cannot access '/nonexistent': No such file or directory
- Use redirection to handle output:
ls -l /etc > filelist.txt # Save output to a file ls /nonexistent 2> error.txt # Save error to a file
5. Using man and --help
- Every command has a manual:
man command - Or quick help:
command --help
Example:
man cp
cp --help
This will show options and usage for the cp command. RHCSA often tests your ability to explore commands like this.
6. Best Practices for the Exam
- Always check your current directory with
pwd. - Verify files before removing with
ls. - Practice using sudo and root commands.
- Learn at least 15β20 essential commands fluently.
- Use Tab completion and man pages to avoid mistakes.
- Understand the difference between stdout and stderr.
β Summary for the Exam
- Know how to open a shell (locally and via SSH)
- Know root vs regular user access (
suandsudo) - Understand command syntax:
command [options] [arguments] - Be fluent in basic Linux commands (
ls,cd,cp,mv,rm,mkdir,cat,man) - Use options and arguments correctly
- Handle output and errors with redirection
- Use help (
manand--help) to understand commands
This is the foundation for the rest of the RHCSA exam, because all tasks start with accessing the shell and running commands.
