Janik von Rotz


2 min read

NCurses Disk Usage

The ncdu command line utility is the perfect tool to analyse your disk usage. Here is a short introduction.

Open a shell, navigate into a directory and the enter ncdu. The program starts scanning the folder and subs folders. Depending on the depth of folder and file count this may take a while.

  ┌── Scanning... ───────────────────────────────────────────────────────────────────────────┐
  │                                                                                          │
  │ Total items: 2,294,498      size: 120.3 GiB                                              │
  │   /home/janikvonrotz/.npm/_cacache/index-v5/fe/b0                                        │
  │                                                                                          │
  │                                                                                          │
  │                                                                                          │
  │ Scanning.                                                               Press q to abort │
  └──────────────────────────────────────────────────────────────────────────────────────────┘

Once finished it presents you a list of file in the current folder.

--- /home/janikvonrotz --------------------------------------------------------------------------
   32.4 GiB S 107.9 MiB [#############] /.local
   29.9 GiB S   2.8 GiB [###########  ] /.cache
   24.7 GiB S   2.3 GiB [#########    ] /Odoo-Build
   10.0 GiB             [####         ] /Odoo-CD
    5.9 GiB             [##           ] /janikv.cloud
    3.7 GiB             [#            ] /.thunderbird
    2.7 GiB S   5.6 MiB [#            ] /.config
    2.1 GiB             [             ] /.var
    1.6 GiB             [             ] /.librewolf
    1.4 GiB             [             ] /janikvonrotz.ch
    1.3 GiB S 553.4 MiB [             ] /Ansible-Build
    1.3 GiB             [             ] /.npm

Use vi keybindings to navigate. With j and k you move up and down the list. With h and l you navigate into the folder and up the parent folder.

Once you identified a file that can be deleted hit d. Then confirm the deletion.

--- /home/janikvonrotz/.local/share/Trash/files -------------------------------------------------
                            /..
    2.7 GiB [#####┌── Confirm delete ────────────────────────────────────────┐
    2.6 GiB [#####│ Are you sure you want to delete "wp-content.zip"?        │
  749.8 MiB [##   │                                                          │
  700.2 MiB [#    │                                                          │
  700.2 MiB [#    │              yes       no    don't ask me again          │
  352.1 MiB [     └──────────────────────────────────────────────────────────┘
  352.1 MiB [             ] /download

If you want to learn more about a file press i and with b you can spawn a shell in the current directory.

I think that is all you need to know.

Category: linux
Tags: 100daystooffload , diskusage , ncdu , linux , unpredictability

Edit Page / Show Statistic