Bird
0
0

Given the history output:

medium📝 Command Output Q4 of 15
Linux CLI - Environment and Configuration
Given the history output:
  200  ls
201 cd /var/log
202 tail syslog
203 ls -l
204 grep error syslog

What command will rerun the last command starting with ls?
A!ls
B!200
C!ls -l
D!204
Step-by-Step Solution
Solution:
  1. Step 1: Understand history event designators

    Using !ls reruns the most recent command starting with 'ls'.
  2. Step 2: Check other options

    !200 reruns command number 200 ('ls'), but not the most recent starting with 'ls'; !ls -l is invalid syntax (expands to ls -l -l); !204 reruns command 204 which starts with grep.
  3. Final Answer:

    !ls -> Option A
  4. Quick Check:

    Rerun last command starting with 'ls' = !ls [OK]
Quick Trick: Use !prefix to rerun last command starting with prefix [OK]
Common Mistakes:
  • Using full command after !
  • Confusing command numbers
  • Using wrong event number

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes