Bird
0
0

How can you modify this command to exclude the grep process itself from the output? ps aux | grep ssh | wc -l

hard📝 Application Q9 of 15
Linux CLI - Pipes and Redirection
How can you modify this command to exclude the grep process itself from the output? ps aux | grep ssh | wc -l
Aps aux | grep ssh | -v grep | wc -l
Bps aux | grep -v ssh | wc -l
Cps aux | grep ssh | wc -l | grep -v grep
Dps aux | grep ssh | grep -v grep | wc -l
Step-by-Step Solution
Solution:
  1. Step 1: Understand the problem

    The grep command itself appears in the output because it contains 'ssh'.
  2. Step 2: Use grep -v to exclude grep process

    Adding grep -v grep removes lines containing 'grep' from the output before counting.
  3. Final Answer:

    ps aux | grep ssh | grep -v grep | wc -l -> Option D
  4. Quick Check:

    Exclude grep process with grep -v grep [OK]
Quick Trick: Use grep -v grep to exclude grep process from output [OK]
Common Mistakes:
  • Using grep -v before grep ssh
  • Misplacing grep -v
  • Typo in grep -v option

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes