โ† All Linux Flashcard Decks

Text Processing & Editors Flashcards

7 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Text Processing & Editors flashcards as text
  1. What does `grep -v "error" logfile` display?

    Answer: Lines that do NOT contain the word 'error'

    The -v flag inverts the match, so grep -v displays only the lines that do not contain the specified pattern.

  2. In vim's normal mode, which key switches to insert mode placing the cursor before the current character?

    Answer: i

    Pressing 'i' in vim's normal mode enters insert mode, positioning the cursor to insert text just before the current character.

  3. What does `awk 'NR==3 {print}' file` do?

    Answer: Prints only the third line of the file

    NR is awk's built-in variable for the current record number; NR==3 is true only when processing the third line.

  4. What does `sed -i 's/old/new/g' file` do?

    Answer: Modifies the file in-place, replacing all occurrences

    The -i flag tells sed to edit the file in-place, making changes directly to the file rather than writing to stdout.

  5. What does `grep -c "pattern" file` return?

    Answer: The count of lines that match the pattern

    grep -c suppresses normal output and prints only the total number of lines that match the given pattern.

  6. Which awk built-in variable defines the input field separator?

    Answer: FS

    FS (Field Separator) defines the delimiter awk uses to split each input record into fields; it defaults to whitespace.

  7. What does the `join` command do in Linux?

    Answer: Combines lines from two sorted files that share a common field

    The join command performs a relational join on two sorted files, combining lines that share a matching field value.