Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to find all .txt files and list their details using ls.
Linux CLI
find . -name "*.txt" -exec [1] {} \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cat' will print file contents, not list details.
Using 'rm' will delete files, which is dangerous here.
Using 'echo' will just print the filename without details.
✗ Incorrect
The command 'ls -l' lists detailed information about each found file. Using -exec with ls -l shows details of each .txt file.
2fill in blank
mediumComplete the code to find all .log files and delete them safely.
Linux CLI
find /var/log -type f -name "*.log" -exec [1] {} \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ls' only lists files, does not delete.
Using 'cat' prints file contents, no deletion.
Using 'touch' changes timestamps, no deletion.
✗ Incorrect
The 'rm' command deletes files. Using it with -exec removes each found .log file.
3fill in blank
hardFix the error in the code to find all .conf files and change their permissions to 644.
Linux CLI
find /etc -name "*.conf" -exec chmod [1] {} \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 755 gives execute permission, not needed here.
Using 777 gives full permissions, risky for config files.
Using 600 restricts access too much.
✗ Incorrect
Permission 644 means read/write for owner, read for group and others, suitable for config files.
4fill in blank
hardFill both blanks to find all .sh files and make them executable by the owner only.
Linux CLI
find ~/scripts -name "*.sh" -exec chmod [1] [2] \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '644' is a permission number, not a symbolic mode.
Using '755' gives execute permission to all, not owner only.
Forgetting '{}' causes syntax errors.
✗ Incorrect
The command 'chmod u+x' adds execute permission for the owner. '{}' is the placeholder for each found file.
5fill in blank
hardFill all three blanks to find all .bak files older than 7 days and delete them.
Linux CLI
find /backup -name "*.bak" -mtime +[1] -type [2] -exec [3] {} \;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'd' for type selects directories, not files.
Using 'mtime' without '+' finds files modified exactly 7 days ago.
Using 'ls' or other commands instead of 'rm' won't delete files.
✗ Incorrect
The '-mtime +7' finds files older than 7 days, '-type f' restricts to files, and 'rm' deletes them.