Bird
0
0

Identify the error in this PowerShell command that tries to list files:

medium📝 Debug Q14 of 15
PowerShell - Basics and Environment
Identify the error in this PowerShell command that tries to list files:
ls -l | grep ".txt"
APowerShell does not support ls -l syntax
Bgrep is not a native PowerShell command
CQuotes around .txt should be single quotes
DThe pipe symbol | is invalid in PowerShell
Step-by-Step Solution
Solution:
  1. Step 1: Check command compatibility

    PowerShell supports ls alias but not with -l option; it uses Get-ChildItem instead.
  2. Step 2: Identify grep usage

    grep is a Linux command, not native in PowerShell; PowerShell uses Where-Object or Select-String.
  3. Final Answer:

    PowerShell does not support ls -l syntax -> Option A
  4. Quick Check:

    ls -l syntax unsupported = PowerShell does not support ls -l syntax [OK]
Quick Trick: PowerShell ls alias lacks Bash -l flag [OK]
Common Mistakes:
  • Assuming ls -l works fully in PowerShell
  • Thinking pipe | is invalid
  • Believing quote style causes error here

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes