0
0
Linux CLIscripting~20 mins

find command basics in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Find Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Find files by name
What is the output of this command if the current directory contains files: report.txt, data.csv, and notes.txt?
Linux CLI
find . -name '*.txt'
ASyntax error
B./data.csv
C
report.txt
notes.txt
D
./report.txt
./notes.txt
Attempts:
2 left
💡 Hint
The -name option filters files by pattern, including the path.
💻 Command Output
intermediate
1:30remaining
Find files by size
What files will this command list if the directory has files: a.log (500 bytes), b.log (1500 bytes), and c.log (2500 bytes)?
Linux CLI
find . -size +1000c
ANo output
B
./a.log
./b.log
./c.log
C
./b.log
./c.log
D./a.log
Attempts:
2 left
💡 Hint
The -size +1000c finds files larger than 1000 bytes.
📝 Syntax
advanced
2:00remaining
Correct find syntax for multiple conditions
Which option correctly finds files with extension .txt or .md in the current directory?
Afind . -name '*.txt' -o -name '*.md'
Bfind . -name '*.txt' -and -name '*.md'
Cfind . -name '*.txt' -or -name '*.md'
Dfind . -name '*.txt' || -name '*.md'
Attempts:
2 left
💡 Hint
Use the correct logical OR operator for find.
🔧 Debug
advanced
2:00remaining
Why does this find command fail?
This command is intended to find all files modified in the last 7 days but returns no results. Why? find . -mtime 7
AIt should use -mmin instead of -mtime
BIt finds files modified exactly 7 days ago, not within 7 days
CThe command syntax is invalid
DIt only finds directories, not files
Attempts:
2 left
💡 Hint
Check what the number after -mtime means.
🚀 Application
expert
2:30remaining
Find and delete empty files safely
Which command safely finds and deletes all empty files in the current directory and its subdirectories?
Afind . -type f -empty -delete
Bfind . -empty -exec rm {} \;
Cfind . -type f -size 0 -exec rm -f {} \;
Dfind . -type f -size 0 -delete
Attempts:
2 left
💡 Hint
Use the safest and simplest way to delete empty files with find.