0
0
Linux CLIscripting~10 mins

grep -r for recursive search 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 search recursively for the word 'error' in all files.

Linux CLI
grep [1] error *
Drag options to blanks, or click blank then click option'
A-i
B-n
C-v
D-r
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.
2fill in blank
medium

Complete 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'
A-l
B-r
C-c
D-q
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.
3fill in blank
hard

Fix 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'
A-n
B-v
C-i
D-c
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.
4fill in blank
hard

Fill 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'
A-r
B-i
C-n
D-v
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.
5fill in blank
hard

Fill 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'
A-r
B-i
C-l
D-n
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.