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 using quotes causes the shell to expand the pattern incorrectly.
Using a wildcard like '*.txt' finds all text files, not just 'notes.txt'.
✗ Incorrect
The find command requires the filename pattern in quotes to correctly match the exact file name 'notes.txt'.
2fill in blank
mediumComplete the code to find all files with '.log' extension modified in the last 7 days.
Linux CLI
find /var/log -name [1] -mtime [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting '*.log' causes shell to expand before find runs.
Using 'log' instead of '*.log' matches only files named exactly 'log'.
Using '7' instead of '-7' finds files modified exactly 7 days ago.
✗ Incorrect
The -name option needs the pattern '*.log' in quotes to find all log files. The -mtime -7 selects files modified within the last 7 days (newer than 7 days old).
3fill in blank
hardFix the error in the command to find all files larger than 1MB in /home directory.
Linux CLI
find /home -size [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '1M' finds files exactly 1MB, not larger.
Using '1MB' is invalid syntax for find.
✗ Incorrect
The '+1M' means files larger than 1 Megabyte. Without '+', it looks for files exactly 1M.
4fill in blank
hardFill both blanks to find all files owned by user 'alice' and print their names.
Linux CLI
find /home -user [1] -exec [2] {} \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ls' with -exec prints detailed info, not just names.
Using 'cat' tries to display file contents, which may be large or binary.
✗ Incorrect
The -user option needs the username 'alice'. The -exec with 'echo' prints the file names.
5fill in blank
hardFill all three blanks to create a dictionary of filenames and their sizes for files larger than 100KB.
Linux CLI
sizes = { [1]: [2] for [3] in $(find . -type f -size +100k) } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names causes errors.
Not using os.path.getsize() returns wrong values.
✗ Incorrect
Use 'file' as the loop variable, get size with os.path.getsize(file), and use 'file' as the key.