Tag Archives: size

tdu (and dugroup): I can think of no better title

I don’t mind being wrong, so long as it’s in the right direction.

A year ago I thought tdu was somehow not working. It was an honest mistake; I couldn’t remember how or why it worked when I used it years ago, and thought it had fallen into disrepair.

Quite to the contrary though:

2014-05-20-jk7h5f1-tdu

The missing ingredient was that tdu, like ccze and some other utilities, really doesn’t do anything by itself — instead, it expects data to be piped through it. Ergo,

du -a | tdu

gives you an explorable tree showing file sizes and structure. Easy as pie.

Most of what you can extract from du comes through in tdu, although I notice that some conventions, like the human-readable flag -h, seem to pollute the output.

tdu has a few commands while running, most of which you can skim through by pressing the ? key. Perhaps most interesting are n, which sorts by name, or S, which sorts biggest to smallest.

For what it’s worth, there’s a second, lesser utility on the tdu home page, called dugroup. That lets you clump files in groups according to type — backup, image, sound file, etc. — when they appear in du’s output.

As you can imagine, tdu’s output can change a little bit with that thrown into the mix.

tdu’s home page describes it as “a text-mode disk usage full-screen folding outline doohickey utility thingamabob.” I honestly can’t think of a better title than that. ๐Ÿ˜‰

ncdu: You need this tool

Just this morning I ran out of space on a small external drive that I use for system backups and stashing the odd ISO image.

And the first thing I grabbed after the error message was ncdu.

2014-01-31-lv-r1fz6-ncdu

ncdu is one of the best tools available that doesn’t fit neatly into any one category. It’s not quite a file manager, even though it does have some fundamental file management functions.

And it’s not a tree navigator, even if it does display its information in a basic array of nested directory links.

What it does instead is run through the tree, find file sizes and show what’s taking up space. And at times, that can be the most amazing thing.

ncdu’s help screens appear with the ? key, which makes it very easy to learn. Sorting, reverse sorting, display options and error messages are all listed there.

The conventional du and df tools are fine and dandy, and I wouldn’t suggest replacing them at all.

I can say though that ncdu replaced them for me, years ago. And I still use it, even today. ๐Ÿ˜

findimagedupes: Exactly what it says

I ran past duplicate file searches not long ago with fdupes; here’s one specifically aimed at duplicate images. …

2013-11-10-lv-r1fz6-findimagedupes

The aptly-named findimagedupes. Hey, that’s what I would name it, if it was my program. ๐Ÿ˜‰

This one has a little history to it, so I’m a little surprised that it took me this long to find it. It’s the story of my life, really. ๐Ÿ™„

As I understand it, findimagedupes scans md5sums and “fingerprints” to find images that are the same, or visually similar.

One thing in particular I liked about it was the option to spawn an image viewer program to check the lists it produced.

I should say that I used the term “visually similar” above, because if I read the results right, I’m getting false positives on some matches on my system.

I stacked the deck with three straightaway copied documents in that folder, but it worries me a little that some of the others listed were not … quite the same.

Try it and see if you’re getting the same results. Not that it would matter much if it was designed to look for similar images, only if it was picking out files that were completely unalike. ๐Ÿ˜ฏ

fdupes: The perfect solution to a duplicate problem

So I ran into a little problem the other day, when I spliced together two folders of wallpaper and ended up with a bunch that were probably the same.

Rather than riffle through them one by one and delete the duplicates, I dug around a little on the Internet and found fdupes.

2013-10-31-lv-r1fz6-fdupes

Simple enough, fdupes checks file sizes, MD5 sums and does byte-by-byte comparisons, and where it finds similarities, it spits out the name.

To add to the fun though, you can trigger an interactive mode, and fdupes will eradicate the ones that you decree.

Exactly what I needed to solve my problem: I get a short list of files that are most likely identical, I pick the one I don’t want, and fdupes takes care of the rest.

For every task, there is a perfect tool. ๐Ÿ˜ˆ

dd, df and du: Pop quiz

Here are three tools you probably already know, if you’ve spent any time at the terminal since picking up Linux: dd, du and df.

All three come from coreutils, and I’m betting they’re installed on your system.

And in the interest of … being interesting, let’s turn this around and you give the answers.

  1. Show the amount of disk space that’s free, in units that are easily readable by (normal) human beings. Bonus: Show only one type of filesystem.
  2. Create an image of a floppy disc. ๐Ÿ™‚ Bonus: Show the results on-screen … in hex. ๐Ÿ˜ˆ
  3. Show the size of folders in the /etc directory, in numbers that are easy to read, and include a total for the entire directory. Bonus: Show only the top ten, sorted highest to lowest, but no total.

You’re allowed to use external programs to finish the bonuses. ๐Ÿ™‚

Like I said, you probably already know these tools and even if you can’t come up with answers on your own, you have the entire Intarnets at your disposal. Consider it an open-book test. ๐Ÿ˜‰

dirsplit: A hidden hero

A long, long time ago when I was still trapped in Windows, I used to rely on an obscure directory splitting utility to back up personal files to CD.

It wasn’t particularly clever; all it did was sort the contents of a directory and find the optimum collection to fill a volume. It was more of a math gimmick than any feat of programming.

I don’t back up files to CDs any more, but I do find it nifty that dirsplit is in the cdrkit suite.

2013-10-02-v5-122p-dirsplit

Same idea, just in a quicker, more accessible format. Declare the size of your media, a folder of target files, maybe a few other flags, and dirsplit will let you know what should go where.

It will even move all the files to destination folders, making it easy to take the next step of moving them to media.

dirsplit, in my rather overblown opinion, really should stand alone as a program rather than just allow itself to be bundled in with cdrkit.

After all, you can use this for any media size — even some that don’t exist — and so it’s not limited to optical formats.

Be that as it may, it’s worth installing all of cdrkit to get at dirsplit. A coveted gold smilie for dirsplit: ๐Ÿ˜€

Bonus: D is for Debian

About six months ago I scoured an ancient Debian package-a-day web site for all its fruit (with bew, if you must know), and came up with a long list of applications … some text-only, some graphical.

The graphical stuff has been going to the Package of the Day subreddit, and the rest I kept for future reference.

One side effect of that scouring (not necessarily good or bad) was that there was a huge crop of Debian-specific stuff. And of course, almost all of it starts with D.

So here’s a quick rundown on a few things that you can take advantage of, but really only if you’re using Debian or a derivative.

  • alien: Like deb2targz, which I just mentioned, alien will convert .deb packages to tar.gz format.

    2013-10-02-4dkln41-alien

    It will though, also convert to rpm, slp, LSB and even Solaris format. It can patch on-the-fly, incorporate scripts into packages and a lot more. deb2targz is good, but if you use Debian anyway, you should probably grab alien instead.

  • debian-goodies: dpkg, aptitude, apt-cache and apt-get always satisfied almost every need I had in Debian, but debian-goodies adds a lot more tools to the mix.

    2013-10-02-4dkln41-debian-goodies

    Some of the coolest? debget, which bypasses aptitude and company to yank just a package off the repository. And dpigs, which shows which packages are hogging space. ๐Ÿ˜‰

  • dh-make-perl: I know next to nothing about perl or Debian packaging, but if I understand the description correctly, this should be a help with both.

    2013-10-02-4dkln41-dh-make-perl

    I leave it to you to pick up the torch on that one.

  • deborphan: deborphan has been around forever, and it’s one of the first things I used to install whenever I worked with either Debian or Ubuntu.

    2013-10-02-4dkln41-deborphan

    deborphan skillfully skims through lost or detached packages on your system and lists them as orphans. It makes it quite easy to recover space after a mess of installations, or to check for leftover crud. (By the way, Arch users have something similar in pacman -Qqtd … you’re welcome. ๐Ÿ˜‰ )

  • dlocate: Again, if I understand the description and the help flags, dlocate amplifies some of the search functions of dpkg.

    2013-10-02-4dkln41-dlocate

    It’s more than just a replacement for dpkg -S though, as you can see above. Check the help flag; it’s got a ton of features.

  • discover-config: I have this on my list as a hardware check system, but it seems unwieldy and I’m not sure if it’s meant to be used beyond boot scripts.

    2013-10-02-4dkln41-discover-config

    It works sure enough, but I might just be mishandling it. The package page and man pages might give more information.

  • dwww: I’ll mention just one more, and I don’t have a screenshot because I couldn’t figure out how to get it working. dwww, as all the program descriptions and man pages suggest, allows you to peruse documentation with a browser. I tried for a little bit but got no love from it. If there is a howto out there for setting it up, send me a link. I’m curious.

That’s enough from the Debian pond now. If you’re not a Debian fan, you probably found this excruciating to start with, but if you have any swirly in your bloodstream you might find something fun to mess with there.

We now return you to your regularly scheduled blog. ๐Ÿ˜‰