#author("2023-04-25T20:53:13+09:00","","")
#author("2023-04-25T20:55:25+09:00","","")
#navi(../)

* ストレージ使用容量を確認できるncduコマンド [#bf2cd21b]
ターミナル上で動作し、ビジュアルな表示でとても見やすく便利な ncdu コマンドを紹介します。~
ターミナル上で du コマンドを利用しても確認できますが…(苦笑)~
Ubuntu系、Debian系、Raspberry Pi OS(Raspbian) などれあれば、aptコマンドで簡単にインストールできます。~
以下にインストール手順と実行したときのキャプチャなどを紹介します。

#contents

* 関連記事 [#rec3c238]
-[[各ディレクトリのディスク使用サイズを調べる・du>逆引きUNIXコマンド/各ディレクトリのディスク使用サイズを調べる]]


* インストール方法 [#gf0fa258]
以下の手順でインストールします。

+ ターミナルを起動します。
#br
+ 以下のコマンドを入力し Enter キーを押します。~
パスワード問い合わせが表示されたら、パスワードを入力しEnterキーを押します。
#br
 sudo apt install ncdu -y
#br
ncdu インストール時のキャプチャになります。
#br
#ref(01.png)

* ncduを実行してみる [#e36833fa]
ターミナルから ncdu と入力し Enterキーを押します。~
中止するときは q キーを押すと ncdu が終了し、プロンプトが戻ってきます。

- ncdu 起動~
ncduと入力しEnterキーを押すとスキャンが始まります。~
中止するときは q キーを押せば処理が終了します。
#br
#ref(02.png)
#br
スキャン後のキャプチャとなります。
スキャン中のキャプチャとなります。
#br
#ref(03.png)
#br
スキャン後のキャプチャとなります。
#br
#ref(04.png)
#br

* ncdu コマンドの使い方 [#nd43a858]
ncdu コマンドのヘルプを見てみました。
 $ ncdu --help
 ncdu <options> <directory>
 
  -h,--help                  This help message
  -q                         Quiet mode, refresh interval 2 seconds
  -v,-V,--version            Print version
  -x                         Same filesystem
  -e                         Enable extended information
  -r                         Read only
  -o FILE                    Export scanned directory to FILE
  -f FILE                    Import scanned directory from FILE
  -0,-1,-2                   UI to use when scanning (0=none,2=full ncurses)
  --si                       Use base 10 (SI) prefixes instead of base 2
  --exclude PATTERN          Exclude files that match PATTERN
  -X, --exclude-from FILE    Exclude files that match any pattern in FILE
  -L, --follow-symlinks      Follow symbolic links (excluding directories)
  --exclude-caches           Exclude directories containing CACHEDIR.TAG
  --exclude-kernfs           Exclude Linux pseudo filesystems (procfs,sysfs,cgroup,...)
  --confirm-quit             Confirm quitting ncdu
  --color SCHEME             Set color scheme (off/dark)
ncdu ディレクトリ指定で、指定したディレクトリ配下の使用容量の確認ができることがヘルプからわかりますね。
 ncdu ディレクト

以上、ターミナルでストレージの使用容量をビジュアルで確認できる ncdu コマンドの紹介でした。

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS