Find Files By Size

Make Files And Directories

touch sales.txt, marketing.txt, data_science.csv, product.html; mkdir sales marketing

View Files And Directories

ls -l
total 8
-rw-rw-r-- 1 chris chris    0 Jul 31 09:02 data_science.csv,
drwxrwxr-x 2 chris chris 4096 Jul 31 09:02 marketing
-rw-rw-r-- 1 chris chris    0 Jul 31 09:02 marketing.txt,
-rw-rw-r-- 1 chris chris    0 Jul 31 09:02 product.html
drwxrwxr-x 2 chris chris 4096 Jul 31 09:02 sales
-rw-rw-r-- 1 chris chris    0 Jul 31 09:02 sales.txt,

Find Find Files Smaller Than 1M

In this code, we want files smaller than (-) one (1) megabyte (M). You can customize the smaller/greater, number, and unit of file size (e.g. gigabytes is G) to fit your specific need.

find ~/linux_tutorials -size -1M
/home/chris/linux_tutorials/sales.txt,
/home/chris/linux_tutorials/marketing.txt,
/home/chris/linux_tutorials/product.html
/home/chris/linux_tutorials/data_science.csv,