Recall & Review
beginner
What does the
find command do in Linux?The
find command searches for files and directories in a directory hierarchy based on conditions like name, type, size, or modification time.Click to reveal answer
beginner
How do you use
find to search for files named notes.txt in the current directory and its subdirectories?Use
find . -name "notes.txt". The dot . means start from the current directory.Click to reveal answer
beginner
What option do you use with
find to search only for directories?Use
-type d to find directories only. For example, find . -type d lists all directories.Click to reveal answer
intermediate
How can you find files larger than 1 megabyte using
find?Use
-size +1M. For example, find . -size +1M finds files bigger than 1 megabyte.Click to reveal answer
intermediate
What does the
-exec option do in the find command?It runs a command on each file found. For example,
find . -name "*.log" -exec rm {} \; deletes all .log files found.Click to reveal answer
Which command finds all files named
report.txt starting from the current directory?✗ Incorrect
Option D correctly uses
find starting at current directory . with -name to find the file.What does
find /home -type f -size +10M do?✗ Incorrect
The
-type f means files, and -size +10M means larger than 10 megabytes.How do you find all directories named
backup?✗ Incorrect
Option A searches for directories (
-type d) named backup starting from current directory.What is the purpose of the curly braces
{} in find . -name "*.txt" -exec rm {} \;?✗ Incorrect
Curly braces
{} are replaced by each file found by find when running the -exec command.Which option limits
find to search only in the current directory, not subdirectories?✗ Incorrect
The
-maxdepth 1 option tells find to search only the current directory level.Explain how to use the
find command to locate files by name and then delete them safely.Think about searching files and running a delete command on each.
You got /5 concepts.
Describe how to find all directories named 'config' starting from your home directory.
Focus on directory type and name filtering.
You got /5 concepts.