0

With the command whereis I can get the location of the files but instead summing all the sizes of those files I would like to know if there is simpler way to do this.

1
  • 1
    This is going to be distribution-dependent. You can edit your post with more details so that people can help you. Oct 12, 2015 at 7:06

2 Answers 2

1

This answer depends on the distribution you are using. Try to figure out from which package the file is distributed like xterm for instance, then get the package size by quering the package repository.

Debian/Ubuntu sample:

which xterm
/usr/bin/xterm

dpkg -S /usr/bin/xterm
xterm: /usr/bin/xterm

apt-cache show xterm|grep -i size
Installed-Size: 1659
Size: 664882

RedHat/CentOS:

which ls
yum whatprovides /usr/bin/ls
coreutils-8.22-11.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo        : base
Matched from:
Filename    : /usr/bin/ls
.
.
more output
.
.

yum info coreutils-8.22-11.el7.x86_64|grep -i size
Size        : 14 M

Solaris 11:

which ls
/usr/bin/ls

pkg search /usr/bin/ls
INDEX      ACTION VALUE      PACKAGE
path       file   usr/bin/ls pkg:/system/[email protected]

pkg info pkg:/system/[email protected] |grep -i size
          Size: 37.58 MB
0

Use:

ls -lah /path/to/file

To see the file size of said file.

Examples:
# ls -lah /usr/sbin/httpd
-rwxr-xr-x 1 root root 348K Aug 24 17:53 /usr/sbin/httpd

# ls -la /usr/sbin/httpd 
-rwxr-xr-x 1 root root 355712 Aug 24 17:53 /usr/sbin/httpd

Note:

Personally, I find it much easier to use the which command rather than the whereis command.

# which httpd
/usr/sbin/httpd

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .