Linux folder used space - Bash TreeSize

 

To find out which folder needs how much space, the command “du” can be used on Debian. For an even better overview there is the commandline tool ncdu, which can analyze all folders similar to TreeSize.

du

du -ah -d1 /var/www/vhosts

The parameter -d1 shows only first level folders

-mh

a... used space for all files and

h...Human Readable, i.e. in a readable format: K, M, ... for kilobytes, megabytes, ...

Memory hog

Journal

If the Linux Journal becomes very large, it can be limited as follows:

Only the most recent entries are then kept:

root@server:/var/log/journal# du -ah -d1 
3.8G    ./dbd2984f94c34d65b0839d60d6f48b1b
8.1M    ./53955387d3174396b874db791b202516
3.8G    .

In the following file the journal can be limited:

 vi /etc/systemd/journald.conf

As an example on 500M

SystemMaxUse=500M
SystemMaxFileSize=100M

/var/lib/mlocate

PRUNEPATHS customize:

sudo vi /etc/updatedb.conf

sudo updatedb

ncdu - NCurses Disk Usage

With ncdu an overview of the used space for all folders can be displayed very quickly:

sudo apt install ncdu

After Installation for example the Root-Partition can be scanned using the following command:

sudo ncdu / -x

The Parameter -x excludes other mounted Disks (Do not cross filesystem boundaries, i.e. only count files and directories on the same filesystem as the directory being scanned.)

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details