RHCSA Essential Command-Line Tools Flashcards
6 cards from real RHCSA practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 RHCSA Essential Command-Line Tools flashcards as text
A system administrator needs to find all files within the `/etc` directory that are owned by the `root` user and have been modified in the last 7 days. Which command will accomplish this?
Answer: find /etc -user root -mtime -7
The correct command is `find /etc -user root -mtime -7`. The `find` command searches the specified path (`/etc`). The `-user root` predicate selects files owned by 'root'. The `-mtime -7` predicate selects files whose data was modified less than 7 days ago (i.e., within the last 7 days). `-mtime +7` would find files modified more than 7 days ago, and `-mtime 7` would find files modified exactly 7 days ago.
Which of the following commands correctly creates a bzip2-compressed tar archive named `backup.tar.bz2` containing the contents of the `/home/user/data` directory?
Answer: tar -cjf backup.tar.bz2 /home/user/data
The correct command is `tar -cjf backup.tar.bz2 /home/user/data`. The `-c` flag is for creating an archive. The `-j` flag specifies bzip2 compression. The `-f` flag is used to specify the output archive filename. The `-z` flag is for gzip compression, `-x` is for extracting, and omitting a compression flag like `-j` or `-z` would create an uncompressed archive.
A system administrator needs to search through `/var/log/messages` for lines containing the exact word 'error', but not 'errors' or 'error-code'. Which command should be used?
Answer: grep -w 'error' /var/log/messages
The `grep -w 'error' /var/log/messages` command is correct. The `-w` option tells `grep` to select only those lines containing matches that form whole words. A simple `grep 'error'` would match substrings. `grep -v` inverts the match, showing lines that do not contain 'error'. `grep -i` performs a case-insensitive search.
An application with PID 2501 is completely unresponsive. The administrator first tried `kill 2501`, but the process did not terminate. What is the most appropriate next command to forcefully stop the process?
Answer: kill -9 2501
The command `kill -9 2501` sends the SIGKILL signal. This is a non-catchable, non-ignorable signal that is handled directly by the kernel to terminate the process immediately. The default `kill` command and `kill -15` both send SIGTERM, which is a polite request to terminate that an unresponsive process can ignore. `kill -1` (SIGHUP) typically tells a process to reload its configuration. While `killall -9` could also work, using the specific PID with `kill -9` is more direct when the PID is already known.
To perform an in-place replacement of every occurrence of the IP address `10.0.1.50` with `10.0.2.50` within the file `/etc/config.txt`, which `sed` command should be used?
Answer: sed -i 's/10.0.1.50/10.0.2.50/g' /etc/config.txt
The correct command is `sed -i 's/10.0.1.50/10.0.2.50/g' /etc/config.txt`. The `-i` flag modifies the file in-place. The `s/.../.../` is the substitute command. The `g` flag at the end ensures the replacement is global, affecting all occurrences on a line, not just the first. Redirecting output to the same file you are reading from can truncate the file, and omitting the `g` flag will only replace the first match on each line.
A user account named `testuser` exists. A system administrator needs to add this user to the `wheel` supplementary group and also change their login shell to `/usr/bin/zsh`. Which of the following commands accomplishes both tasks in a single operation?
Answer: usermod -aG wheel -s /usr/bin/zsh testuser
The command `usermod -aG wheel -s /usr/bin/zsh testuser` is correct. `usermod` is used to modify an existing user. The `-aG` flags append (`-a`) the user to a supplementary group (`-G`). It is critical to use `-a` to avoid removing the user from other supplementary groups. The `-s` flag sets the new login shell. `useradd` is for creating new users. Omitting `-a` with `-G` would replace the user's supplementary group list entirely.
Written and edited by Nathan Beja, founder of Practice Test Geeks, with AI assistance. Exam facts are checked against the official sources linked below. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- redhat.com — Test delivery, retake policy, score release, renewal, score validity, exam information · verified Dec 2026