Recall & Review
beginner Click to reveal answer
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.beginner Click to reveal answer
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.beginner Click to reveal answer
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.intermediate Click to reveal answer
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.intermediate Click to reveal answer
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.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.
