This exercise is designed to reinforce your knowledge of the locate
command and the find
command with a focus on tests for type, size, and pre-existing tests in Linux. You will practice finding files and directories on your Linux system based on various criteria.
- Access to a Linux command line interface.
- Understanding of the
locate
andfind
commands. - Familiarity with file types and size specifications in Linux.
- Knowledge of pre-existing tests for the
find
command.
- Update the
locate
database before starting the exercises. - Use the
locate
command to find all instances of thepasswd
file on your system. - Try to locate any
.conf
files related tohttpd
(Hint: The filename might contain the stringhttpd
and end with.conf
).
- Use the
find
command to list all files that end with.conf
within/etc
. - Find all regular files within your home directory that are larger than 5MB and have not been accessed in the last 30 days.
- Search for all block device files in the
/dev
directory.
- Find all empty files within the
/var/log
directory. - Use the
find
command to identify all files that have been modified more than 7 days ago but less than 14 days ago in the/home
directory. - Locate files in the
/tmp
directory that are not owned by the current user (replace "current user" with your actual username if necessary).
Combine multiple tests in a single find
command to list all regular files within the /var/log
directory that are larger than 10MB and were modified in the last two days, but ignore files in any subdirectory named archive
.