Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to find all files named 'notes.txt' in the current directory and its subdirectories.
Linux CLI
find . -name [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the filename, which may cause shell expansion.
Using double quotes which may allow shell expansion in some cases.
Using a wildcard like '*.txt' which matches more files than needed.
✗ Incorrect
The find command requires the filename pattern to be quoted to avoid shell expansion. Using single quotes around 'notes.txt' is the correct way.
2fill in blank
mediumComplete the code to find all directories named 'backup' starting from the root directory.
Linux CLI
find / -type [1] -name 'backup'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-type f' which searches for files, not directories.
Using invalid type letters like 'x'.
✗ Incorrect
The '-type d' option tells find to look for directories only.
3fill in blank
hardFix the error in the code to find files larger than 1 megabyte in the /var directory.
Linux CLI
find /var -size [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting '+' which searches for files exactly 1M in size.
Using lowercase 'm' which is not recognized.
Using '-' which searches for files smaller than 1M.
✗ Incorrect
The '+1M' means files larger than 1 megabyte. Without '+', it means exactly 1M, and '-' means smaller than 1M.
4fill in blank
hardComplete the code to find all files modified within the last 7 days and print their names.
Linux CLI
find /home/user -type f -mtime [1] -print Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+7' which finds files modified more than 7 days ago.
Adding extra space before '-print' causing syntax error.
✗ Incorrect
The '-mtime -7' finds files modified less than 7 days ago. The '-print' option is default and can be omitted or included without extra space.
5fill in blank
hardFill all three blanks to find all '.log' files owned by user 'admin' and delete them.
Linux CLI
find /var/log -name [1] -user [2] -exec [3] {} \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting '*.log' causing shell to expand before find runs.
Using wrong user name or command in '-exec'.
Forgetting to escape semicolon in '-exec'.
✗ Incorrect
Use '-name '*.log'' to find log files, '-user admin' to filter by owner, and '-exec rm {} \;' to delete each found file.