1
0

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 5 years have passed since last update.

指定プロジェクト内のサイズ容量確認

Posted at

EC2で立ち上げたRailsアプリケーションの容量を確認しようと使ったコマンドを紹介します。

通常、フォルダ内の容量を確認する場合、以下のコマンドを使うのが一般的ですがカレントディレクトリにフォルダやファイルが多い場合その全てが表示されてしまい見えずらくなってしまいます。

$ du -h

カレントディレクトリのフォルダごとに確認したい場合は以下のコマンドを使用します。

$ du -sh app # 検索したいフォルダ名

しかし、このコマンドではRailsアプリケーション内のルートフォルダ全ての容量を確認したい場合、1つ1つフォルダを指定する必要があります。
なので、以下のようにカレントディレクトリをパイプで繋ぐ方法を採用しました。

$ ls | xargs du -sh

4.0K	Gemfile
8.0K	Gemfile.lock
4.0K	README.md
4.0K	Rakefile
188K	app
32K	bin
112K	config
4.0K	config.ru
28K	db
12K	lib
20K	log
4.0K	package.json
20K	public
4.0K	storage
60K	test
45M	tmp
236M	vendor

これで、Railsアプリケーション内のルートフォルダ全ての容量を確認することができました。

おまけ

トータルの容量も一緒に表示させたい場合は以下のコマンドを使用します。

$ ls | xargs du -shc

4.0K	Gemfile
8.0K	Gemfile.lock
4.0K	README.md
4.0K	Rakefile
188K	app
32K	bin
112K	config
4.0K	config.ru
28K	db
12K	lib
20K	log
4.0K	package.json
20K	public
4.0K	storage
60K	test
45M	tmp
236M	vendor
281M	合計
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?