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