0
0
PowerShellscripting~10 mins

PowerShell vs Bash vs CMD comparison - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to list files in the current directory using PowerShell.

PowerShell
Get-ChildItem [1]
Drag options to blanks, or click blank then click option'
A-File
B-List
C-Path .
D-Name
Attempts:
3 left
💡 Hint
Common Mistakes
Using -List which is not a valid parameter for Get-ChildItem.
Using -File which filters only files, not listing all items.
Using -Name which lists only names, not full details.
2fill in blank
medium

Complete the code to print the current directory path in Bash.

PowerShell
echo [1]
Drag options to blanks, or click blank then click option'
A$PWD
B$HOME
C$PATH
D$USER
Attempts:
3 left
💡 Hint
Common Mistakes
Using $HOME which points to the home directory, not current directory.
Using $PATH which is for executable search paths.
Using $USER which is the username.
3fill in blank
hard

Fix the error in this CMD command to list files with details.

PowerShell
dir [1]
Drag options to blanks, or click blank then click option'
A/w
B/a
C/q
D/p
Attempts:
3 left
💡 Hint
Common Mistakes
Using /w which shows wide format but less detail.
Using /p which pauses output but does not change details.
Using /q which shows file owner but not full details.
4fill in blank
hard

Fill both blanks to create a PowerShell command that lists only files larger than 1MB.

PowerShell
Get-ChildItem [1] | Where-Object { $_.Length [2] 1MB }
Drag options to blanks, or click blank then click option'
A-File
B-Directory
C-gt
D-lt
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Directory instead of -File to filter folders.
Using -lt which means less than, opposite of what is needed.
5fill in blank
hard

Fill all three blanks to create a Bash command that finds all '.txt' files and counts them.

PowerShell
find [1] -name [2] | wc [3]
Drag options to blanks, or click blank then click option'
A.
B"*.txt"
C-l
D-w
Attempts:
3 left
💡 Hint
Common Mistakes
Using -w with wc which counts words, not lines.
Using directory other than current (.) which changes search location.
Not quoting the '*.txt' pattern causing shell expansion issues.