How to delete all files by size using Ubuntu terminal

The example below shows how to delete multiple files by their size using the Linux terminal.

Important:

  • it’s highly recommended you BACK UP your files before performing bulk commands – particularly ones that delete!
  • you can see which files are selected first by removing -delete from the command

Delete all jpg files in current folder less than 600 KB

find . -maxdepth 1 -name "*.jpg" -size -600c

How can I customise this command?

include sub-folders remove -maxdepth 1
include all file types remove -name “*.jpg”
file size by kilobytes (e.g. 600 KB) change to -size 600k
file size by megabytes (e.g 600 MB) change to -size 600M
file size MORE than change to -size +600M
file size EXACTLY change to -size 600M