0
0
Linux CLIscripting~10 mins

find command basics 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 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'notes.txt'
D*.txt
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.
2fill in blank
medium

Complete 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'
Ad
Bf
Cl
Dx
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-type f' which searches for files, not directories.
Using invalid type letters like 'x'.
3fill in blank
hard

Fix 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'
A-1M
B+1M
C1m
D1M
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.
4fill in blank
hard

Complete 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'
A-7
B+7
D -print
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.
5fill in blank
hard

Fill 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'
A'*.log'
Badmin
Crm
Dls
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'.