Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to list files and send the output to the next command using a pipe.
Linux CLI
ls [1] grep 'txt'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&' runs commands in background, not piping output.
Using ';' runs commands sequentially but does not connect output.
Using '>' redirects output to a file, not to another command.
✗ Incorrect
The pipe symbol '|' sends the output of 'ls' as input to 'grep'.
2fill in blank
mediumComplete the command to count the number of lines containing 'error' in a log file using pipes.
Linux CLI
cat /var/log/syslog [1] grep 'error' [2] wc -l
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&' instead of pipe breaks the chain.
Using '>' redirects output to a file, not to next command.
✗ Incorrect
The pipe '|' passes output from one command to the next in a chain.
3fill in blank
hardFix the error in the command that tries to list all '.log' files and count them using pipes.
Linux CLI
ls *.log [1] wc -l Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&&' or '||' instead of pipe breaks the data flow.
Using ';' runs commands separately without passing output.
✗ Incorrect
The pipe '|' correctly sends the list output to 'wc -l' to count lines.
4fill in blank
hardFill both blanks to filter running processes for 'ssh' and then sort them by memory usage.
Linux CLI
ps aux [1] grep ssh [2] sort -k4 -nr
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ';' runs commands separately without passing output.
Using '&' runs commands in background, breaking the chain.
✗ Incorrect
Pipes '|' chain the output of each command to the next for filtering and sorting.
5fill in blank
hardFill all three blanks to find all '.txt' files, count lines containing 'hello', and save the count to a file.
Linux CLI
find . -name '*.txt' [1] xargs grep 'hello' [2] wc -l [3] count.txt
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ';' instead of pipes breaks the data flow.
Using '|' instead of '>' for file redirection causes errors.
✗ Incorrect
Use pipe '|' to chain commands and '>' to redirect final output to a file.