Today's article is definitely a theme...

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
11,971
Reaction score
10,576
Credits
98,977
So, we've covered a zillion and three ways to check how much storage you're using. Today's article does that again!

I mean, why not? I like that there are a zillion ways to do things in Linux. I like sharing the various methods and exposing people to new ways.

Today, we're just mucking about with the 'du' command. You won't even have to install anything.


There you go!
 


Good article David.

All these years using Linux and I didn't know the du cmd existed:- LOL!
 
Good article David.

All these years using Linux and I didn't know the du cmd existed:- LOL!

LOL It's all good. There's surely applications I've never heard of - that are installed by default. There's never any end of things to write about.

I just finished my next article up for a couple of days from now. It's quite different. Point being, there's so much content that I've not yet run out - and I'm going on three years of this.
 
LOL It's all good. There's surely applications I've never heard of - that are installed by default. There's never any end of things to write about.

I just finished my next article up for a couple of days from now. It's quite different. Point being, there's so much content that I've not yet run out - and I'm going on three years of this.
Given that every executable is available for tips, then the basic available bank is quite large, for example on this machine:
Code:
[tom@min ~]$ expr "$(ls /usr/bin | wc -l)" + "$(ls /usr/sbin | wc -l)"
2678

Then for each one of those, there are numerous possibilities for tips on so many options, switches, configurations ... it starts to look like near life-long fun :)
 
Something is wrong with the du command and I never liked the command anyway because it spams the console:

Bash:
sudo du -hs /


However that 603G exceeds my entire SSD (sdb), root is at /dev/mapper/msi--vg-root and the only other partition is swap which is 24G which totals to 500GiB SSD but du reports 603G on root partition alone!

Code:
df -h
Filesystem                Size  Used Avail Use% Mounted on
udev                      7,7G     0  7,7G   0% /dev
tmpfs                     1,6G  1,6M  1,6G   1% /run
/dev/mapper/msi--vg-root  434G   13G  400G   3% /
tmpfs                     7,8G  7,3M  7,8G   1% /dev/shm
tmpfs                     5,0M     0  5,0M   0% /run/lock
/dev/sdb2                 448M   81M  339M  20% /boot
/dev/sdb1                 511M  6,0M  505M   2% /boot/efi
/dev/sda1                 916G  590G  280G  68% /media/Data
tmpfs                     1,6G   68K  1,6G   1% /run/user/1000
 
Something is wrong with the du command and I never liked the command anyway because it spams the console:

Bash:
sudo du -hs /



However that 603G exceeds my entire SSD (sdb), root is at /dev/mapper/msi--vg-root and the only other partition is swap which is 24G which totals to 500GiB SSD but du reports 603G on root partition alone!

Code:
df -h
Filesystem                Size  Used Avail Use% Mounted on
udev                      7,7G     0  7,7G   0% /dev
tmpfs                     1,6G  1,6M  1,6G   1% /run
/dev/mapper/msi--vg-root  434G   13G  400G   3% /
tmpfs                     7,8G  7,3M  7,8G   1% /dev/shm
tmpfs                     5,0M     0  5,0M   0% /run/lock
/dev/sdb2                 448M   81M  339M  20% /boot
/dev/sdb1                 511M  6,0M  505M   2% /boot/efi
/dev/sda1                 916G  590G  280G  68% /media/Data
tmpfs                     1,6G   68K  1,6G   1% /run/user/1000
Do these commands make any difference?:
Code:
du -sh --apparent-size /
du -shx /
 
Do these commands make any difference?:
This one makes things worse lol

sudo du -sh --apparent-size /

129T /

This one reports correct amount, I thought if you specify directory such as root (/) then that's what it works on but it apparently does not
sudo du -shx /

13G /

Anyway sudo is required to run on root to avoid errors accessing privilledged files and directories
 
it starts to look like near life-long fun

I'm hitting three years soon. I've yet to technically miss a publication date. I did cheat during a major catastrophe, but articles were technically published.

However that 603G exceeds my entire SSD (sdb), root is at /dev/mapper/msi--vg-root and the only other partition is swap which is 24G which totals to 500GiB SSD but du reports 603G on root partition alone!

Do you have an external drive plugged in? It'll happily read /media/blah...
 
Do you have an external drive plugged in? It'll happily read /media/blah...
Yeah it's my secondary disk, a HDD.

The command help is misleading, it says:

du --help

Code:
Usage: du [OPTION]... [FILE]...

However [FILE] is ignored unless -x is specified, the correct usage is:
Code:
Usage: du [OPTION]...
Usage: du -x [OPTION]... FILE...
 
LOL It's all good. There's surely applications I've never heard of - that are installed by default. There's never any end of things to write about.

I just finished my next article up for a couple of days from now. It's quite different. Point being, there's so much content that I've not yet run out - and I'm going on three years of this.
With Linux I don't think we will ever run out of things to write about.:)
 
With Linux I don't think we will ever run out of things to write about.:)

I am inclined to agree. I may repeat myself from time to time, 'cause I've now written more than I can possibly remember. I write a great deal.
 

Members online


Top