Skip to main content

Posts

Showing posts with the label commands

How To Find Files Over a Certain Size Using Redhat/CentOS/Fedora Linux

Here is a quick tip for all of those Redhat/CentOS/Fedora users out there. Do you need to find all files over a certain size, either in a specific directory, your current directory, or in your entire computer/server? No problem, just execute the following: find / -type f -size +500000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' In the example above, I am looking for all files over 500MB in size (500000k, where k = kilobytes). The place where I have typed "/" in the above command indicates the path to search in. By selecting "/" I am searching in the entire filesystem; I could easily indicate a specific directory by changing my command as follows: find /path/to/my/directory -type f -size +500000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' Alternatively, I could search in my current directory by replacing "/" with "." like so: find . -type f -size +500000k -exec ls -lh {} \; | awk '{ pri