Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to update the locate database before searching.
Linux CLI
sudo [1] Drag options to blanks, or click blank then click option'
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.
✗ Incorrect
The command 'updatedb' updates the database used by 'locate' for fast filename searching.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
Using quotes around 'notes.txt' ensures locate searches for the exact filename.
3fill in blank
hardFix 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'
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.
✗ Incorrect
The '-i' option makes locate search case-insensitively for the given pattern.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using head -5 which is deprecated.
Not quoting the search pattern.
Using just '5' without '-n' for head.
✗ Incorrect
The locate command searches for 'log' and 'head -n 5' limits output to 5 lines.
5fill in blank
hardFill 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'
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'.
✗ Incorrect
First, 'updatedb' updates the database, then 'locate -i '*.conf'' searches ignoring case, and 'head -n 3' limits output.