6 Examples to Find Files in Linux with Find Command

Table of Contents

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. It can find directories and files by their name, their type, or extension, size, permissions, etc.

Find command searches for files and directories in a directory hierarchy based on a user given expression and can perform user-specified action on each matched file.

Find Command Syntax

The general syntax for the find command is as follows:

find [options] [path…] [expression]

  • The options attribute controls the treatment of the symbolic links, debugging options, and optimization method.
  • The path… attribute defines the starting directory or directories where find will search the files.
  • The expression attribute is made up of options, search patterns, and actions separated by operators.

Find Files with Name

  • find . -name howtouselinux.txt Find Files Using Name in Current Directory
  • find /home -name howtouselinux.txt Find Files Under Home Directory
  • find / -type d -name howtouselinux Find Directories Using Name
  • find . -type f -name “*.txt” Find all txt Files in Current Directory

Find Files with Permission

  • find . -type f -perm 0777 -print Find Files With 777 Permissions
  • find / -type f ! -perm 777 Find Files Without 777 Permissions
  • find / -perm 2644 Find SGID Files with 644 Permissions
  • find / -perm 1551 Find Sticky Bit Files with 551 Permissions

Find Files with User and Group

  • find /home -user howtouselinux Find all Files Based on User
  • find /home -group howtouselinux Find all Files Based on Group

Find Files and Directories Based on Date and Time

  • find / -mtime 50 Find Last 50 Days Modified Files
  • find / -atime 50 Find Last 50 Days Accessed Files
  • find / -mtime +50 –mtime -100 Find Last 50-100 Days Modified Files
  • find / -cmin -60 Find Changed Files in Last 1 Hour

Find Files and Directories Based on Size

  • find / -size 50M Find 50MB Files
  • find / -size +50M -size -100M Find Size between 50MB – 100MB
  • find / -type f -size +100M find larger than 100MB files
  • find / -type f -name *.mp3 -size +10M Find all .mp3 files with more than 10MB

Find Files with Not operator

  • find . -type f -not -name “*.html” Find files not ending with the .html file extension
  • find . -type f ! -name “*.html” Find files not ending with the .html file extension


Find File By Name in Linux

20 Advanced Linux Find Command Examples

How to use Find Command in Linux

3 Ways to find the largest files in Linux

10 Linux Find Exec examples – Advanced Part

Table of Contents

Share on facebook
Share on twitter
Share on linkedin

You might also like