
そのコマンドを使用すると、whereis
ファイルの場所を取得できますが、これらのファイルのすべてのサイズを合計するより簡単な方法があるかどうかを知りたいです。
答え1
この回答は、使用しているディストリビューションによって異なります。たとえば、ファイルがどのパッケージにデプロイされたかを調べ、パッケージリポジトリに問い合わせてxterm
パッケージサイズを取得します。
Debian/Ubuntu の例:
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
Red Hat/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
ソラリス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
答え2
使用:
ls -lah /path/to/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
メモ:
個人的にどの代わりにコマンドどこ注文する。
# which httpd
/usr/sbin/httpd