0
0
Linux CLIscripting~10 mins

Pipe operator (|) in Linux CLI - Interactive Code Practice

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

Complete the code to list all files and then count the lines using the pipe operator.

Linux CLI
ls -l [1] wc -l
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 '>' redirects output to a file, not to another command.
Using ';' runs commands sequentially but does not pipe output.
2fill in blank
medium

Complete the code to find all '.txt' files and count them using the pipe operator.

Linux CLI
find . -name '*.txt' [1] 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, which does not pass output.
Using '>' redirects output to a file, not to another command.
Using ';' runs commands one after another without piping.
3fill in blank
hard

Fix the error in the code to correctly pipe the output of 'ps aux' to 'grep bash'.

Linux CLI
ps aux [1] grep bash
Drag options to blanks, or click blank then click option'
A|
B>
C||
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&' runs command in background, not piping output.
Using '||' runs second command only if first fails, no piping.
Using '>' redirects output to a file, not to another command.
4fill in blank
hard

Fill both blanks to list all running processes and filter those containing 'ssh'.

Linux CLI
ps [1] [2] grep ssh
Drag options to blanks, or click blank then click option'
Aaux
B|
C-ef
D&&
Attempts:
3 left
💡 Hint
Common Mistakes
Using '&&' instead of pipe, which does not pass output.
Using 'aux' with '&&' instead of pipe.
Not using any option with 'ps' to list all processes.
5fill in blank
hard

Fill all three blanks to list files, filter those with '.log', and count them.

Linux CLI
ls [1] [2] grep [3] | wc -l
Drag options to blanks, or click blank then click option'
A-l
B|
C.log
D-a
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-a' instead of '-l' for listing files.
Using ';' or '&&' instead of pipe '|'.
Not specifying '.log' to filter log files.