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.

特定のディレクトリ配下のファイルを容量の大きい順に表示する。(MB表示)

Posted at

# ls -la --block-size=MB $(find "ディレクトリ名" -type f) | sort -nr -k5 | head

例)「/var/log」の場合

# ls -la --block-size=MB $(find /var/log/ -type f) | sort -nr -k5 | head
-rw-------  1 root   utmp   46MB  3月  1 06:43 /var/log/btmp-20190301
-rw-------  1 root   root   16MB  2月 17 07:52 /var/log/secure-20190217
-rw-r--r--  1 mysql  mysql  14MB  3月  1 14:28 /var/log/mysqld.log
-rw-------  1 root   root   13MB  2月 24 08:28 /var/log/secure-20190224
-rw-------  1 root   root   13MB  2月  3 06:06 /var/log/secure-20190203
-rw-------  1 root   root   11MB  2月 17 07:52 /var/log/fail2ban.log-20190217
-rw-------  1 root   root   11MB  2月  3 06:05 /var/log/maillog-20190203
-rw-------  1 root   root   10MB  2月 17 07:51 /var/log/maillog-20190217
-rw-------  1 root   root   10MB  2月 10 03:48 /var/log/maillog-20190210
-rw-------  1 root   root    9MB  2月 24 08:28 /var/log/maillog-20190224
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?