Bird
0
0

You want to find and rerun a command that contains the word backup anywhere in it, but you don't remember the exact command start. Which is the best way to do this?

hard📝 Application Q15 of 15
Linux CLI - Environment and Configuration
You want to find and rerun a command that contains the word backup anywhere in it, but you don't remember the exact command start. Which is the best way to do this?
APress <code>Ctrl + r</code> and type 'backup' to search interactively
BUse <code>!backup</code> to rerun the command
CRun <code>history | grep backup</code> and then rerun manually
DUse <code>!! backup</code> to rerun last backup command
Step-by-Step Solution
Solution:
  1. Step 1: Understand searching commands with unknown start

    !string only matches commands starting with string, so !backup won't find commands containing 'backup' elsewhere.
  2. Step 2: Identify interactive search method

    Ctrl + r lets you search history interactively for any substring, including 'backup'.
  3. Final Answer:

    Press Ctrl + r and type 'backup' to search interactively -> Option A
  4. Quick Check:

    Use Ctrl + r for substring history search [OK]
Quick Trick: Use Ctrl + r to search history by any word quickly [OK]
Common Mistakes:
  • Assuming !backup matches anywhere in command
  • Trying !! backup which is invalid syntax
  • Relying only on grep without rerun shortcut

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes