ls を使用 ファイルのコマンドと du ディレクトリのコマンド。
ファイル サイズの確認
ls -l filename #Displays Size of the specified file
ls -l * #Displays Size of All the files in the current directory
ls -al * #Displays Size of All the files including hidden files in the current directory
ls -al dir/ #Displays Size of All the files including hidden files in the 'dir' directory
ls コマンドは、ディレクトリの実際のサイズを一覧表示しません (なぜですか?)。したがって、du を使用します。
ディレクトリ サイズの確認
du -sh directory_name #Gives you the summarized(-s) size of the directory in human readable(-h) format
du -bsh * #Gives you the apparent(-b) summarized(-s) size of all the files and directories in the current directory in human readable(-h) format
-h を含む 上記のコマンドのいずれかのオプション (例:ls -lh * または du -sh ) は、人間が読める形式 (kb) でサイズを示します。 、 mb ,gb , ...)
詳細については、man ls を参照してください。 と man du
du があります コマンド。
ディレクトリおよび/またはファイルのサイズ (人にわかりやすい方法で):
$ du -sh .bashrc /tmp
存在しない英単語 dush として覚えました .
--apparent-size コマンド ライン スイッチを使用すると、見かけのサイズを測定できます (ls 実際のディスク使用量ではなく)。
ls -s を使用 ファイルサイズをリストするか、または ls -sh を好む場合 人間が読めるサイズ。
ディレクトリには du を使用します 、そして再び du -h 人間が読めるサイズ。