Linuxでファイルとディレクトリのサイズを確認するにはどうすればよいですか?を使用するとdf -m
、すべてのディレクトリのサイズが最上位に表示されますが、ディレクトリ内のディレクトリとファイルについて、サイズを確認するにはどうすればよいですか?
ls
ファイルにはdu
commandを、ディレクトリにはcommandを使用します。
ファイルサイズの確認
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
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加