
To find the files accessed within the last 10 minutes, use the -amin option. find /home -type f -mtime +6 -mtime -15 Files and directories accessed within the last 10 minutes You can also look for the files in the /home directory modified within the last 10 days using the command find /home -mtime -10 Find files modified within a specific period.įor example, all files modified between 6 and 15 days ago in the home directory. find /home -atime +10įiles accessed exactly 10 days ago find /home -atime 10Īccessed within the last 10 days find /home -atime -10 Find files modified within the last n days To see files that have not been accessed within the last 10 days in the home directory. This allows you to see files that have or haven’t been accessed within a specified period. mtime -10 -type d Find files based on access or modificationįind files based on date or time accessed. Looks for directories modified within the last 10 days find. This will look for files modified within the last 17 hours find. The -mtime +8 will look for txt files that are older than 8 days. type d –empty Find files by age or modification timeįind files older than n days find /path/ -type f -name '*.txt' -mtime +8 When looking for files within a specific range such as between 100 and 200 MB find / -size +100M -size -200M Look for directories larger than 20kbįind / -type d -size +20k Find empty files and directories.ĭirectories find. type f -size -10M Find files with sizes between 100-200MB To Search find all 30MB files find / -size 30M Find files larger than a specified size find -size +2M G – Gigabytes Find files of a certain size – equal to 30MB Use the appropriate size format depending on the type of files or directories you are searching for. You can find all files or directories that are smaller, equal or greater than a certain size, within a certain range or empty. The general syntax for the find command is find Įxplore more grep command examples.

Find file in terminal how to#
We will then show you how to use the -exec option to act on the files or directories based on their size, permissions, etc. This will show you how to find files and directories. In this article, we will start by explaining the basic Linux find commands with examples. Adding the -exec option enables sysadmins to run external commands and perform actions like copying, moving, deleting, or changing permissions of the files matching the specified criteria such as size, name, etc.


It can find directories and files by their name, their type, or extension, size, permissions, etc.īesides locating files and directories, combining the find command with others enables you to take action on the results. The Linux find command is a powerful tool that enables system administrators to locate and manage files and directories based on a wide range of search criteria.
