LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-21-2023, 06:29 PM   #1
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Rep: Reputation: 172Reputation: 172
announcing Disk Top Ten (dtt) 1.0a, a "where's my disk space" utility


dtt picks up where du leaves off. It quickly summarizes filesystem usage into a "top ten" list of the largest directory trees or individual objects. For example:

Code:
$ dtt /usr
        20224024 (grand total - allocated 512B-blocks)
         2125648 /usr/bin
         1098840 /usr/include
          918552 /usr/share/locale
          647688 /usr/lib64/python3.9
          595376 /usr/libexec/gcc/x86_64-slackware-linux/11.2.0
          524024 /usr/share/fonts/TTF
          514264 /usr/share/texmf-dist/tex
          500104 /usr/doc/rust-1.58.1/html/core
          488744 /usr/lib64/firefox
          479104 /usr/lib64/thunderbird
Or it can aggregate by filename suffix:

Code:
$ dtt -s /usr
        20224024 (grand total - allocated 512B-blocks)
         4289864
         2200080 .so
         1632144 .html
          922456 .mo
          899704 .0
          688784 .h
          458432 .3
          449296 .13
          384032 .gz
          381904 .ja
Plus it supports options to use file length instead of file size (like du), or simply count files.

Source package, Slackware 15.0 package, and documentation are here: https://metaed.com/papers/dtt/

If you can't reach the site, you are connecting from a country that it's shielded from because of high attack rate -- at the moment that's CN, VN, RU, HK, SG, IN, KR, TW, BR, JP, FR, and ID. Let me know which country and and I'll lower shields for you.
 
Old 04-22-2023, 01:59 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
I can't get there from Paris, France.
 
Old 04-22-2023, 07:18 AM   #3
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 777

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Where du leaves off, the unix pipeline starts...
Code:
$ du -chs /usr/* | sort -hr | head -n 10
25G	total
11G	/usr/share
7.5G	/usr/lib64
2.2G	/usr/doc
2.1G	/usr/bin
1.5G	/usr/src
715M	/usr/include
604M	/usr/libexec
115M	/usr/man
76M	/usr/sbin
Sorry I couldn't help myself. Unix was built around the "do one thing well" and be able to pipe input/output, for situations like this.

Nothing wrong with trying build your own software, I just wanted to mention how I would find "top ten" largest objects in a dir.
 
8 members found this post helpful.
Old 04-22-2023, 08:40 AM   #4
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,377

Rep: Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757
Personally, I use this script that I call mydu.sc
Code:
#!/bin/bash

# Script to show a quick summary of a directory's disk usage.
# Defaults to current directory

DIR=${1:-$(pwd)}
# Handle the "." directory case so that grep works
[[ $DIR == "." ]] && EDIR="\." || EDIR=$DIR
du -c "$DIR" | grep  -v "$EDIR$"  | sort -k1nr
It avoids the -s option to du so that large files will show and the -h option to du so that the following sort will work. The output can be piped to 'head -10'
 
1 members found this post helpful.
Old 04-22-2023, 06:44 PM   #5
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by 0XBF View Post
Code:
$ du -chs /usr/* | sort -hr | head -n 10
Well yes, but actually no. That approach can only tell you the ten largest objects one level below a given root node. dtt goes further. It actually focuses in on the ten largest individual subtrees at any level below the root node. When your question is where exactly did my space go, it's a much more helpful answer.

Here's a head to head comparison where I ask both tools the same question.

Code:
# du -cs -B512 /usr/* | sort -hr | head -n 10
20224016        total
8064152 /usr/lib64
5606064 /usr/share
2135968 /usr/bin
2084016 /usr/doc
1098840 /usr/include
818408  /usr/libexec
206104  /usr/man
135048  /usr/sbin
32752   /usr/info

# dtt /usr/*
        20224016 (grand total - allocated 512B-blocks)
         2135968 /usr/bin
         1098840 /usr/include
          918552 /usr/share/locale
          647688 /usr/lib64/python3.9
          595376 /usr/libexec/gcc/x86_64-slackware-linux/11.2.0
          524024 /usr/share/fonts/TTF
          514264 /usr/share/texmf-dist/tex
          500104 /usr/doc/rust-1.58.1/html/core
          488744 /usr/lib64/firefox
          479104 /usr/lib64/thunderbird
What I learn immediately from dtt is that I should consider whether to keep Python, GCC, Tex, Rust, Firefox, and Thunderbird. du on the other hand just says do more research starting from lib64.
 
3 members found this post helpful.
Old 04-22-2023, 07:08 PM   #6
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by allend View Post
Code:
du -c "$DIR" | grep  -v "$EDIR$"  | sort -k1nr
And this has a different problem -- it gives redundant results that mask out other directories I should be looking at. This approach and the one identified by 0XBF are exactly the limitations I ran into with du, and why I wrote dtt.

Here again is the head to head:

Code:
# du -c -B512 /usr | grep -v '     /usr$' | sort -k1nr | head -10
20224024        total
8064152 /usr/lib64
5606064 /usr/share
2125648 /usr/bin
2084016 /usr/doc
1230920 /usr/doc/rust-1.58.1
1206480 /usr/doc/rust-1.58.1/html
1098840 /usr/include
1013792 /usr/share/texmf-dist
918552  /usr/share/locale

# dtt /usr
        20224024 (grand total - allocated 512B-blocks)
         2125648 /usr/bin
         1098840 /usr/include
          918552 /usr/share/locale
          647688 /usr/lib64/python3.9
          595376 /usr/libexec/gcc/x86_64-slackware-linux/11.2.0
          524024 /usr/share/fonts/TTF
          514264 /usr/share/texmf-dist/tex
          500104 /usr/doc/rust-1.58.1/html/core
          488744 /usr/lib64/firefox
          479104 /usr/lib64/thunderbird
The du approach tells me to look at /usr/doc/rust-1.58.1/html, and at /usr/doc/rust-1.58.1 and at /usr/doc, but dtt tells me the problem is /usr/doc/rust-1.58.1/html/core and then moves on to other subtrees.
 
Old 04-22-2023, 07:57 PM   #7
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by Didier Spaier View Post
I can't get there from Paris, France.
I raised the block on FR, you should have no trouble now.
 
Old 04-23-2023, 02:12 AM   #8
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
Quote:
Originally Posted by metaed View Post
I raised the block on FR, you should have no trouble now.
Yes, thanks. But the archive dtt-1.0a-noarch-1.tar.gz is not compressed as a Slackware package
Code:
LANG=C tar xzf  dtt-1.0a-noarch-1.tgz 
tar: .: Cannot utime: Operation not permitted
tar: .: Cannot change mode to rwxr-xr-t: Operation not permitted
tar: Exiting with failure status due to previous errors
This extracts the folders usr and install though. Wondering how you built this archive.
 
Old 04-23-2023, 02:42 AM   #9
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Extracts fine here. Used the exact command line you gave, no errors. Normally I extract with 'tar xvf', no errors with that either.

Since we are talking about the package. Could a package tag be added. Example: dtt-1.0a-noarch-1metaed.tgz
 
1 members found this post helpful.
Old 04-23-2023, 04:40 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,970

Rep: Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334
(not to speak about ncdu)
 
2 members found this post helpful.
Old 04-23-2023, 10:41 AM   #11
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by Didier Spaier View Post
Code:
LANG=C tar xzf  dtt-1.0a-noarch-1.tgz 
tar: .: Cannot utime: Operation not permitted
tar: .: Cannot change mode to rwxr-xr-t: Operation not permitted
A Google search suggests this happens when expanding a tarball in /tmp (or another directory having the sticky bit set).
 
1 members found this post helpful.
Old 04-23-2023, 10:50 AM   #12
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
Quote:
Originally Posted by metaed View Post
A Google search suggests this happens when expanding a tarball in /tmp (or another directory having the sticky bit set).
You nailed it. Sorry for the noise and thanks for the heads-up!
 
Old 04-23-2023, 01:31 PM   #13
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by chrisretusn View Post
Could a package tag be added. Example: dtt-1.0a-noarch-1metaed.tgz
Thank you, this is exactly the kind of feedback I'm looking for. This is only the second package I've built. I'm looking at:

https://docs.slackware.com/start?id=...ement_hands_on

and the build number documented there isn't followed by a package tag. Where can I learn about package tags?
 
Old 04-23-2023, 04:01 PM   #14
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Version 1.0.1a released.
This corrects various documentation problems.
There are no functional differences.
At chrisretusn's suggestion, added a package tag.
 
Old 04-23-2023, 07:04 PM   #15
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by metaed View Post
Thank you, this is exactly the kind of feedback I'm looking for. This is only the second package I've built. I'm looking at:

https://docs.slackware.com/start?id=...ement_hands_on

and the build number documented there isn't followed by a package tag. Where can I learn about package tags?
The TAG is not part an official Slackware package which consist of name-version-arch-build. With 3rd party packages it is a common practice to use a tag to differentiate a official Slackware package from a 3rd party package. It's not well documented it is referenced here:
https://www.slackwiki.com/Building_A_Package.

If you look at the SBo templates you will note that the all have a provision for a package tag.
https://slackbuilds.org/templates/

All of my scripts contain the following variables.
Note: My scripts only build for x86_64 architecture. Before I switched to that I used $(arch) in place of x86_64 or $(uname -m) later on in the script when determining architecture.
Code:
PKGNAM=
PKGVER=
ARCH=x86_64
BUILD=1
TAG=cgs
PKGTYPE=txz
With the makepkg stanza consisting of:
Code:
"$PKGNAM"-"$PKGVER"-"$ARCH"-"$BUILD""$TAG"."$PKGTYPE"
The use of tags helps tell an official Slackware package from non-official packages. I even add tags to stock packages that modify the SlackBuild for my purposes. Examples:
My packages: Cython-0.29.30-x86_64-1cgs.txz; cups-2.4.2-x86_64-4cgs.txz; imagemagick-7.1.1_7-x86_64-1cgs.txz
Slackware official packages: Cython-0.29.28-x86_64-1; cups-2.4.2-x86_64-4.txz; imagemagick-7.1.1_7-x86_64-1.txz

Thanks for adding the tag.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
EyeTV DTT on Ubuntu 16.04 LTS Turbocapitalist Linux - Desktop 1 08-08-2017 04:38 AM
A Top Ten List Of Top Ten Lists! cousinlucky General 2 10-29-2011 10:13 AM
LXer: Ten BY TEN. India's IT & BPO Outsourcing. LXer Syndicated Linux News 0 12-26-2005 03:31 PM
Chaintech DigiTOP DTT-1000 TV-card causes Mandrake 9.2 to freeze on startup Karpo Linux - Hardware 1 08-17-2004 09:30 PM
Chaintech DTT-1000 Linux support? make Linux - Hardware 0 04-20-2004 10:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration