0
0
Linux CLIscripting~10 mins

Why pipes chain commands into workflows in Linux CLI - Test Your Understanding

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

Complete 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'
A|
B&
C;
D>
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.
2fill in blank
medium

Complete 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'
A>
B&
C;
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&' instead of pipe breaks the chain.
Using '>' redirects output to a file, not to next command.
3fill in blank
hard

Fix 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'
A&
B|
C;
D||
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&&' or '||' instead of pipe breaks the data flow.
Using ';' runs commands separately without passing output.
4fill in blank
hard

Fill 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'
A|
B&
C;
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using ';' runs commands separately without passing output.
Using '&' runs commands in background, breaking the chain.
5fill in blank
hard

Fill 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'
A|
B>
Attempts:
3 left
💡 Hint
Common Mistakes
Using ';' instead of pipes breaks the data flow.
Using '|' instead of '>' for file redirection causes errors.