0
0
Linux CLIscripting~10 mins

locate for fast filename 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 update the locate database before searching.

Linux CLI
sudo [1]
Drag options to blanks, or click blank then click option'
Afind
Bupdatedb
Clocate
Dgrep
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'locate' instead of 'updatedb' to update the database.
Using 'find' which searches live but is slower.
Using 'grep' which filters text but does not update databases.
2fill in blank
medium

Complete the command to search for files named exactly 'notes.txt' using locate.

Linux CLI
locate [1]
Drag options to blanks, or click blank then click option'
Anotes*
Bnotes
C*.txt
D'notes.txt'
Attempts:
3 left
💡 Hint
Common Mistakes
Searching without quotes which may match partial names.
Using wildcards like '*.txt' which match many files.
Searching just 'notes' which matches any file with 'notes' in the path.
3fill in blank
hard

Fix the error in the command to search case-insensitively for 'Report.pdf'.

Linux CLI
locate [1]
Drag options to blanks, or click blank then click option'
A-c Report.pdf
B--ignore-case Report.pdf
C-i Report.pdf
D-I Report.pdf
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--ignore-case' which is not supported by locate.
Using '-c' which counts matches instead of ignoring case.
Using '-I' which is not a valid option.
4fill in blank
hard

Fill both blanks to search for files containing 'log' in their name and limit output to 5 results.

Linux CLI
locate [1] | head [2]
Drag options to blanks, or click blank then click option'
A'log'
B-n 5
C-5
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using head -5 which is deprecated.
Not quoting the search pattern.
Using just '5' without '-n' for head.
5fill in blank
hard

Fill all three blanks to update the locate database, then search for '.conf' files ignoring case, and show only first 3 results.

Linux CLI
sudo [1] && locate [2] | head [3]
Drag options to blanks, or click blank then click option'
Aupdatedb
B-i '*.conf'
C-n 3
Dlocate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'locate' instead of 'updatedb' to update the database.
Not quoting the '*.conf' pattern.
Using 'head 3' without '-n'.