Difference between revisions of "Ncdu, the treesize for Linux"

From EN Ikoula wiki
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽
Line 10: Line 10:
 
<br>
 
<br>
 
It will allow you to easily move from one directory to another using the cursor keys and even take actions on files such as deleting or moving folders.
 
It will allow you to easily move from one directory to another using the cursor keys and even take actions on files such as deleting or moving folders.
 +
 +
==Installation== <!--T:2-->
 +
 +
Debian, Ubuntu :
 +
 +
$ sudo apt install ncdu
 +
 +
CentOS, AlmaLinux, Rocky Linux:
 +
 +
$ sudo dnf install ncdu
 +
 +
In old system besed in RHEL, you can use yum:
 +
 +
$ sudo yum install ncdu
 +
 +
===Utilisation===
 +
 +
Once installed, you just need to run the command :
 +
 +
$ ncdu
 +
 +
 +
For information, the ncdu when it is launched will read the directory in which you are, you can however indicate the directory that you wish.
 +
 +
*Exemples:
 +
 +
ncdu /
 +
<br>
 +
ncdu /home
 +
<br>
 +
ncdu /var/log
 +
<br>
 +
 +
===Save results to a file===
 +
 +
Sometimes you may want to save your analysis report and view it later. In this case, scan the directory you wish and export the results in any archive format for later consulting, as below.
 +
>br>
 +
For exemple as a file gzip
 +
<br>
 +
ncdu -1xo- / | gzip >rapport.gz
 +
 +
This command will scan the / directory and save the scan report in a file called report.gz.
 +
 +
You can consult it later by running the following command:
 +
 +
$ zcat rapport.gz | ncdu -f-
 +
 +
===Analysis of disk usage in a remote system===
 +
 +
$ ssh -C root@192.168.1.250 ncdu -o- / | ncdu -f-

Revision as of 11:29, 17 November 2022

en:Ncdu, the treesize for Linux fr:Ncdu, le treesize pour Linux


Introduction

NCDU means for NCurses Disk Usage.

Ncdu is a simple and fast disk usage analyzer that is used to find directories or files that take up the most space on a local or a remote system.
It will allow you to easily move from one directory to another using the cursor keys and even take actions on files such as deleting or moving folders.

Installation

Debian, Ubuntu :

$ sudo apt install ncdu

CentOS, AlmaLinux, Rocky Linux:

$ sudo dnf install ncdu
In old system besed in RHEL, you can use yum:
$ sudo yum install ncdu

Utilisation

Once installed, you just need to run the command :

$ ncdu


For information, the ncdu when it is launched will read the directory in which you are, you can however indicate the directory that you wish.

  • Exemples:

ncdu /
ncdu /home
ncdu /var/log

Save results to a file

Sometimes you may want to save your analysis report and view it later. In this case, scan the directory you wish and export the results in any archive format for later consulting, as below. >br> For exemple as a file gzip

ncdu -1xo- / | gzip >rapport.gz

This command will scan the / directory and save the scan report in a file called report.gz.

You can consult it later by running the following command:

$ zcat rapport.gz | ncdu -f-

Analysis of disk usage in a remote system

$ ssh -C root@192.168.1.250 ncdu -o- / | ncdu -f-