

If you need to sift through a lot of files, or just don’t want to fool around with the command line, a GUI application can make it easier to find files based on their size. size +1G -exec ls -1hSs + | head -3Īs seen in these examples, the ls and find commands are both perfect tools when you need to search for files based on their size. This command will find and list files bigger than 1 GB. For the best of both worlds, we can use find to search for files, and combine it with the ls command to list the size in the results, in descending order from biggest to smallest. This command will search for files between 5 GB and 10 GB. It’s also possible to search for files between certain sizes, by combining two -size options in find. Let’s find files that are under 2 GB by using the same syntax as above, but using a - “less than” symbol instead. We can also use find to search for files under a certain size. The + is “greater than” and 2 GB is specified as 2G in the syntax. The -size option tells find to search for files of a certain size. Let’s find files that are more than 2 GB in file size. The find command is an even better way to list files based on their size. This output shows how much space each directory is using, then lists the files (largest to smallest size) in each subdirectory.Įxample 3. If your files are separated into subdirectories, you can add the -R option to get files listed recursively. You’ll also see a total of all file sizes on the first line of the output.Įxample 2. $ ls -1hSsĪs you can see from the output, files are listed largest to smallest. Include the -1 option to list one file per line, the -h option to put the sizes in human-readable format, the -S option to sort the files by their size, and the -s option to show each file’s size. If you already know the location of the files you want to check, we can use the ls command to list files by their file size. Find Files of Certain Size (With Commands)Įxample 1. Check out some of the examples below to get started. In this guide, we’ll go over the commands you can use to find files and directories based on their size in Linux.
#BASH FIND FILE SIZE GREATER THAN FREE#
Whether you need to free up storage, or just want to see which files are largest, there are plenty of Linux commands that can help. Finding files based on their size can help you figure out which files are taking up the most space on your hard drive.
