3

How to find or list file directories which having size more than 100 MB

I'm using du -sh* to get the size of file but my system don't have permission

5
  • What do you mean with "don't have permission"? If the user running the commands does not have permissions to read directory contents you will not be able to find what you want. To search for the whole filesystem you may need to use sudo
    – FedKad
    Dec 3, 2019 at 8:02
  • when I'm using du -sh * then it's throwing error dont have permission Dec 3, 2019 at 8:04
  • here I want size of directories which is having more than 10gb Dec 3, 2019 at 8:05
  • or it maybe more than 1gb Dec 3, 2019 at 8:06
  • In which directory are you trying to run du? Please, edit your question by adding more information, instead of replying in the comments.
    – FedKad
    Dec 3, 2019 at 8:25

2 Answers 2

4

This is a good article: How to Find Out Top Directories and Files (Disk Space) in Linux

One of the commands listed comes close to your directory needs:

$ du -Sh | sort -rh | head -20
8.0G    ./Videos
990M    ./.googleearth/Cache/unified_cache_leveldb_leveldb2
798M    ./.cache/mozilla/firefox/9fu0cuql.default/cache2/entries
643M    ./roboto/Kijiji
378M    ./android-studio/lib
306M    ./roboto
293M    ./Pictures
195M    ./.dropbox-dist/dropbox-lnx.x86_64-84.4.170
193M    ./.cache/google-chrome/Default/Cache
193M    ./Android/Sdk/emulator/qemu/linux-x86_64
177M    ./android-studio/plugins/android/lib/layoutlib/data/fonts
131M    ./.cache/thumbnails/large
130M    ./android-studio/plugins/android/lib
102M    ./.gradle/wrapper/dists/gradle-4.6-all/bcst21l2brirad8k2ben1letg
101M    ./Pictures/1920x1080
93M     ./Android/Sdk/emulator
91M     ./.mozilla/firefox/9fu0cuql.default
90M     ./Android/Sdk/emulator/lib64/qt/lib
80M     ./gmail
80M     ./Downloads

Another of the commands comes close to solving your file size needs:

$ find -type f -exec du -Sh {} + | sort -rh | head -n 20
2.8G    ./Videos/simplescreenrecorder-2019-11-24_17.20.17.mkv
1.3G    ./Videos/simplescreenrecorder-2019-12-01_18.56.29.mkv
1.1G    ./Videos/simplescreenrecorder-2019-11-30_16.16.22.mkv
1.1G    ./Videos/simplescreenrecorder-2019-11-17_18.13.03.mkv
952M    ./Videos/simplescreenrecorder-2019-11-11_21.42.51.mkv
548M    ./Videos/simplescreenrecorder-2019-11-24_20.03.44.mkv
201M    ./Videos/Screencapture 2019-11-08 at 13.07.14.mp4
122M    ./Videos/Screencapture 2019-11-08 at 13.43.55.mp4
102M    ./.gradle/wrapper/dists/gradle-4.6-all/bcst21l2brirad8k2ben1letg/gradle-4.6-all.zip
88M     ./android-studio/lib/platform-impl.jar
66M     ./android-studio/bin/lldb/lib/liblldb.so.7
63M     ./android-studio/jre/jre/lib/rt.jar
62M     ./.AndroidStudio3.2/system/caches/content.dat.storageData
61M     ./android-studio/lib/idea.jar
57M     ./.config/VirtualBox/VBoxGuestAdditions_5.1.38.iso
54M     ./Documents/vio.mp4
48M     ./android-studio/plugins/android/lib/android.jar
46M     ./Downloads/linux-modules-4.14.153-0414153-generic_4.14.153-0414153.201911101449_amd64.deb
45M     ./Android/Sdk/platforms/android-28/android.jar
42M     ./android-studio/lib/java-impl.jar

In both examples, just tweak the number of lines listed to get files over 100 MB. For example change head -n 20 to head -n 40 to list double the number of files.

2
  • WinEunuuchs2Unix Appreciated for great answer... Dec 24, 2020 at 14:06
  • For information, du -Sh --threshold=100M to list only files & folders over 100MB (as asked)
    – NatNgs
    Dec 16, 2022 at 11:33
0

You can simply use find command in order to display only file which are bigger than 100 MB, like that :

sudo find -size +100000k

Explanation :

  • find -size would display all files depending of -size option parameter
  • +100000k would say bigger than 100 000 KB, which is 100 MB

NB : if you aren't inside a subdirectory of your home directory or something like /home/user or /media, you need to use sudo command, or you won't be able to list every files due to Permission denied

4
  • What is the use of piping du output to find?
    – FedKad
    Dec 3, 2019 at 8:55
  • @FedonKadifeli du display all files and folders of the current directory without taking care size of files/folders, so I just add the find command to filter the result
    – damadam
    Dec 3, 2019 at 8:57
  • The find command will just search the current directory and ignore anything from stdin: The output of the du command will be lost!
    – FedKad
    Dec 3, 2019 at 9:02
  • Please, correct your answer, by taking into account my comment above.
    – FedKad
    Dec 3, 2019 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.