How to use the 'find' command in Linux to search for files by file size?
Published on Aug. 22, 2023, 12:17 p.m.
To use the ‘find’ command in Linux to search for files by file size, you can use the following command:
find /path/to/directory -type f -size +1M
This will find all files in the specified directory and its subdirectories that are larger than 1 megabyte. You can replace /path/to/directory
with the path to the directory you want to search, and replace 1M
with the file size you want to search for.
You can also use the k
, M
, and G
suffixes to specify file sizes in kilobytes, megabytes, and gigabytes, respectively. For example:
find /path/to/directory -type f -size +100k
This will find all files in the specified directory and its subdirectories that are larger than 100 kilobytes.
I hope this helps! Let me know if you have any other questions.