0
0
Linux CLIscripting~10 mins

find with -exec for actions 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 .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'
Acat
Bls -l
Crm
Decho
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.
2fill in blank
medium

Complete 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'
Arm
Bcat
Cls
Dtouch
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.
3fill in blank
hard

Fix 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'
A644
B600
C777
D755
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.
4fill in blank
hard

Fill 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'
Au+x
B644
C{}
D755
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.
5fill in blank
hard

Fill 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'
A7
Bf
Crm
Dd
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.