0
0
Linux CLIscripting~10 mins

Why finding files saves time in Linux CLI - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
A"notes.txt"
Bnotes.txt
C*.txt
D"notes"
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'.
2fill in blank
medium

Complete 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'
A"*.log"
B-7
C7
D"log"
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.
3fill in blank
hard

Fix 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'
A1M
B+1M
C-1M
D1MB
Attempts:
3 left
💡 Hint
Common Mistakes
Using '1M' finds files exactly 1MB, not larger.
Using '1MB' is invalid syntax for find.
4fill in blank
hard

Fill 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'
Aalice
Bls
Cecho
Dcat
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.
5fill in blank
hard

Fill 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'
Afile
Bos.path.getsize(file)
Dfilename
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names causes errors.
Not using os.path.getsize() returns wrong values.