Using the Linux find command – Usage with examples

Linux find command tutorial: locate and manage files by name, extension, size, or permissions, and run actions like grep and delete on the matches found.

The Linux find command is a built in powerful tool that can be used to locate and manage files and directories based on a wide range of search criteria.For example, we can find files by their name, extension, size, permissions, etc.

Common Find commands

Searching for a file by name

find . -name data.txt

Find files larger than 100mb in the current dir:

find . -xdev -type f -size +100M

Searching for a specific file in a directory

find ./data -name tests*

Find files by extension:

find . -name *.jpg

Find files or directories with certain names:

# find only files, we need to use the -f option:
find ./ -type f -name "results*"

# To find only directories, we need to use the -d option:
find ./ -type d -name "results*"

Find files in multiple directories

find ./src ./res -name app*.* -type f

Find files containing a certain text

find ./src -type f -exec grep -l -i "getall" {} ;

Find files by size We can even find files by different sizes. Size options are:

  • c - bytes
  • k - kilobytes
  • M - Megabytes
  • G - Gigabytes

Example

find / -size 10M

Find and delete specific files

find . -type f -name "temp*" -exec rm {} ;
Last updated on Jul 28, 2026 21:03 +0300
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy