Got it

Searching for Files by File Size in Linux

111 0 0 0 0

hello, everyone!

this post i will introduce you how to search for files by File Size in Linux, let's see it.


Why do I need this article?

I think this is probably the case. The disk on your Linux machine is full and needs to be cleaned up. Then you need to search for large files to determine whether the files are useful.


specific approach

Search for files whose size is greater than 500 MB.

sudo find / -size +500M


/swap.img

/home/androidyue/file_server/ubuntu_18.04.tar

/home/androidyue/bin/TeamCity-2019.2.2.tar.gz

/proc/kcore

find: ‘/proc/23619’: No such file or directory


Searching for 500 MB files

sudo find / -size 500M



Search for files smaller than 500 MB.

sudo find / -size -500M

/
/opt

/opt/containerd

/opt/containerd/lib

/opt/containerd/bin

/opt/gitlab

/opt/gitlab/sv

/opt/gitlab/sv/prometheus

/opt/gitlab/sv/prometheus/log

/opt/gitlab/sv/prometheus/log/run

/opt/gitlab/sv/prometheus/log/main

/opt/gitlab/sv/prometheus/log/supervise

/opt/gitlab/sv/prometheus/log/supervise/stat

/opt/gitlab/sv/prometheus/log/supervise/status

/opt/gitlab/sv/prometheus/log/supervise/pid

/opt/gitlab/sv/prometheus/log/supervise/lock

/opt/gitlab/sv/prometheus/log/supervise/ok

/opt/gitlab/sv/prometheus/log/supervise/control

/opt/gitlab/sv/prometheus/run

/opt/gitlab/sv/prometheus/env


Searching for files larger than 100 MB and smaller than 500 MB

sudo find / -size -500M -size +100M

/sys/devices/pci0000:00/0000:00:02.0/resource2_wc

/sys/devices/pci0000:00/0000:00:02.0/resource2

/usr/bin/dockerd


Other Finding Units

  • b – for 512-byte blocks (this is the default if no suffix is used)

  • c – for bytes

  • w – for two-byte words

  • k – for Kilobytes

  • M – for Megabytes

  • G – for Gigabytes


Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.