0
0
Linux CLIscripting~10 mins

stderr redirection (2>, 2>>) 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 redirect error messages to a file, replacing its content.

Linux CLI
ls /nonexistent_directory [1] error.log
Drag options to blanks, or click blank then click option'
A>
B2>
C1>
D>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' redirects standard output, not error.
Using '>>' appends instead of replacing.
2fill in blank
medium

Complete the code to append error messages to a file without overwriting it.

Linux CLI
grep 'pattern' file.txt [1] errors.log
Drag options to blanks, or click blank then click option'
A2>>
B2>
C>>
D1>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '2>' overwrites the file instead of appending.
Using '>>' redirects standard output, not error.
3fill in blank
hard

Fix the error in the code to correctly redirect only error messages to a file.

Linux CLI
cat missingfile.txt [1] errors.txt
Drag options to blanks, or click blank then click option'
A2>
B1>
C>
D>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' redirects standard output, missing error messages.
Using '1>' redirects standard output, not error.
4fill in blank
hard

Fill both blanks to redirect standard output to output.log and append errors to error.log.

Linux CLI
command [1] output.log [2] error.log
Drag options to blanks, or click blank then click option'
A>
B2>>
C2>
D>>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '2>' instead of '2>>' will overwrite error.log.
Using '>>' for standard output appends instead of overwriting.
5fill in blank
hard

Fill all three blanks to redirect standard output to output.log, overwrite errors to error.log, and append errors to error_append.log.

Linux CLI
cmd [1] output.log [2] error.log [3] error_append.log
Drag options to blanks, or click blank then click option'
A>
B2>
C2>>
D>>
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up '2>' and '2>>' causes wrong file behavior.
Using '>>' without '2' redirects standard output, not errors.