1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Linux】ディレクトリ内のファイル容量を確認する

Last updated at Posted at 2023-08-22

duコマンド

duコマンドを使用することでディレクトリ内のファイル容量を表示させることができます。

$ du .
8328	./sample/example
280240	./sample
7670680	.

オプション(一部)

-h

次のように実行すると、適切な単位で表示します。

$ du -h .
4.1M	./sample/example
137M	./sample
3.7G	.

-s

次のように実行すると、指定したディレクトリの合計を表示します。

$ du -s .
7670776	.

-d 深さ

次のように実行すると、表示する深さを指定できます。

$ du -d 1 .
7670680	./sample
7670776	.

容量が大きい順に表示する

以下のように実行すると容量が大きい順に表示されます。

du -h . | sort -n -r
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?