0
0
Linux CLIscripting~10 mins

/dev/null for discarding output 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 discard the output of the ls command.

Linux CLI
ls > [1]
Drag options to blanks, or click blank then click option'
A/dev/null
B/dev/zero
C/dev/stdout
D/dev/random
Attempts:
3 left
💡 Hint
Common Mistakes
Using /dev/zero or /dev/random which are for input, not discarding output.
Redirecting to /dev/stdout which shows output instead of hiding it.
2fill in blank
medium

Complete the code to discard both standard output and standard error of the grep command.

Linux CLI
grep 'pattern' file.txt > [1] 2>&1
Drag options to blanks, or click blank then click option'
A/dev/null
B/dev/stdout
C/dev/random
D/dev/zero
Attempts:
3 left
💡 Hint
Common Mistakes
Redirecting only standard output but not standard error.
Using files like /dev/zero which do not discard output.
3fill in blank
hard

Fix the error in the code to discard only the error messages of the cat command.

Linux CLI
cat missingfile.txt 2> [1]
Drag options to blanks, or click blank then click option'
A/dev/stdout
B/dev/null
C/dev/zero
D/dev/random
Attempts:
3 left
💡 Hint
Common Mistakes
Redirecting error to /dev/stdout which shows errors instead of hiding.
Using /dev/random or /dev/zero which are not for discarding output.
4fill in blank
hard

Fill both blanks to discard standard output and standard error of the find command.

Linux CLI
find /path -name '*.txt' > [1] 2> [2]
Drag options to blanks, or click blank then click option'
A/dev/null
B/dev/stdout
C/dev/zero
D/dev/random
Attempts:
3 left
💡 Hint
Common Mistakes
Redirecting one stream to /dev/null and the other to a wrong file.
Using /dev/stdout which shows output instead of hiding.
5fill in blank
hard

Fill both blanks to discard output and error of tar command and run it in background.

Linux CLI
tar -czf archive.tar.gz folder > [1] 2> [2] & disown
Drag options to blanks, or click blank then click option'
A/dev/null
B/dev/stdout
D>/dev/null
Attempts:
3 left
💡 Hint
Common Mistakes
Adding extra arguments to disown which are not needed.
Redirecting output incorrectly with extra symbols.