โ† All RHCSA Flashcard Decks

RHCSA Essential Command-Line Tools Flashcards

7 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 7 RHCSA Essential Command-Line Tools flashcards as text
  1. Which command displays the last 20 lines of a file named 'syslog'?

    Answer: tail -20 syslog

    The tail command with -N flag outputs the last N lines of a file.

  2. What does the command 'wc -l filename' report?

    Answer: Number of lines in the file

    The wc -l option counts and displays the number of newline characters (lines) in a file.

  3. Which command would you use to search for the string 'error' recursively in all files under /var/log?

    Answer: grep -r 'error' /var/log

    grep -r performs a recursive search through directories for a pattern.

  4. What is the effect of running 'sort -u file.txt'?

    Answer: Sorts the file and removes duplicate lines

    The sort -u option sorts lines and suppresses duplicate output lines, keeping only unique entries.

  5. Which sed command replaces only the FIRST occurrence of 'foo' with 'bar' on each line of input?

    Answer: sed 's/foo/bar/' file

    Without the g flag, sed's s command replaces only the first match on each line by default.

  6. What does the 'cut -d: -f1' command do when applied to /etc/passwd?

    Answer: Extracts the first field using colon as delimiter

    cut -d: -f1 uses colon as the field delimiter and extracts field number 1, which is the username in /etc/passwd.

  7. Which command can be used to view a file page by page, allowing both forward and backward navigation?

    Answer: less

    less allows forward and backward navigation through a file, unlike more which only scrolls forward.