Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to search recursively for the word 'error' in all files.
Linux CLI
grep [1] error * Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-i' which ignores case but does not search recursively.
Using '-v' which inverts the match.
Using '-n' which shows line numbers but not recursive search.
✗ Incorrect
The '-r' option tells grep to search recursively through directories.
2fill in blank
mediumComplete the code to recursively search for 'TODO' in the current directory and all subdirectories.
Linux CLI
grep [1] TODO . Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-l' which lists filenames but does not search recursively.
Using '-c' which counts matches but does not search recursively.
Using '-q' which suppresses output.
✗ Incorrect
The '-r' option makes grep search recursively in the current directory '.' and its subdirectories.
3fill in blank
hardFix the error in the command to recursively search for 'main' ignoring case.
Linux CLI
grep -r [1] main ./src Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-v' which inverts the match.
Using '-n' which shows line numbers but does not ignore case.
Using '-c' which counts matches but does not ignore case.
✗ Incorrect
The '-i' option makes grep ignore case when searching.
4fill in blank
hardFill both blanks to recursively search for 'config' and show line numbers.
Linux CLI
grep [1] [2] config /etc
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-v' which inverts matches instead of showing line numbers.
Using '-i' which ignores case but does not show line numbers.
✗ Incorrect
Use '-r' for recursive search and '-n' to show line numbers of matches.
5fill in blank
hardFill all three blanks to recursively search for 'error' ignoring case and show filenames only.
Linux CLI
grep [1] [2] [3] error /var/log
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-n' which shows line numbers instead of filenames.
Mixing up the order of options but order does not affect grep.
✗ Incorrect
Use '-r' for recursive, '-i' to ignore case, and '-l' to list filenames with matches.