Tag Archives: directory

rmlint: The potential to purge

I am behind the power curve today, because of some real-life obligations. I am going to grab something quick and easy so as not to fall behind; things are going to be even busier into the weekend.

This is a snapshot of rmlint in action:


rmlint cruises through your directory tree, and offers to remove files it thinks are duplicates, zero-byte or hollow folders. And as you can see, given enough space, it will take its time to come up with a menu of potential excisions.

I did say “offers,” which is an important distinction. rmlint’s output is a little unexpected: By default it generates a script that will remove suspicious targets, but doesn’t outright eliminate them.

Which is a good thing; it means you have the option to adjust its list, and it also means you take the next step — running the script — with conscious aforethought. You can’t blame rmlint for whacking apart your /usr/lib folder if you told it specifically to do it.

I like rmlint for a number of reasons — it’s rare that I see a system cleaner, it takes the safe route by creating the script, and it has a smidgen of color.

But that’s about all the time I have today; I’ll get deeper into something tomorrow … I promise. šŸ˜‰


ncdt: An interesting evolution

Quick on the heels of tree and ddir, a loyal reader pointed out ncdt, which takes the tree model and adds a small feature or two.


As you can see, ncdt adds the size of files and directories as part of its default display. So in situations where it’s useful to see directory structure and size — such as labeling removable media, like CDs — it is probably more useful.

Unfortunately, I see no options to adjust what ncdt shows, so there are no “human-readable” (which I prefer) output flags or the like. What you see is what you get.

ncdt also promises to show “special” data for mp3 files, but the Debian version as well as the version I built on my Arch system from the Debian source package showed nothing. Even the sample screenshot in Debian doesn’t show anything “special” for mp3 files. Hmmm. šŸ˜¦

It’s possible that there is an added dependency that I don’t have, or perhaps the mp3 files I tried post-date what ncdt is capable of analyzing. I checked the ReadMe and source files, but I got no hints. And the only home page I have for ncdt is the Debian package page above.

No matter. ncdt adds a little to the tree model and could probably, at one time in the past, show a little information about mp3 files. It’s an interesting evolution, even if it still needs some attention to reach fruition.

tree: Two and a half years later. …

I think I have just enough applications to round out the month, before calling it quits. Of course, as luck would have it, somehow I made it through 30 months of text-based applications without mentioning tree. So there will undoubtedly be something leftover at the end.


Mentioning ddir first was probably wise though, since tree does most (if not all) of what ddir can do, and then some. I never did find an option in ddir for line-drawing characters, but tree does that by default, has options for color, can use ANSI lines and even codepage 437 graphics (which may or may not produce decent lines on your machine, without the help of cp437).

And perhaps of interest to higher programming powers than I, tree also has options to export to XML and JSON. It’s not terrifically beautiful, but I can see where that would be a great option to have available.

But that’s about all there is to say about tree. It does much the same as yesterday’s program, just with a little more panache. In Debian, in Arch, in … just about everything, I think.

Now, having mentioned tree, I can safely rewrite all those posts from all these past years about software that relies on tree, like pstree and pass and. … šŸ˜Æ

ddir: Echoes of tree

If you’ve taken a look at the old blog in the last day or so, you’ll know that I’m closing up shop at the end of the month.

The long and boring explanation is over there; the short and snappy one is here: It’s been a decade since I started writing out my Linux experiences there, and two and a half years of chasing down console software here — a lot more than I anticipated on either side.

Suffice to say it’s time for me to move on to new things. I’m also putting an end to the name, so if someone offers you advice in the future and calls themselves “K.Mandla,” it’s not me. šŸ˜•

For today, I have ddir to show. It’s not terribly beautiful, but I think you will see its usefulness.


I’ve known about ddir for a while, but to be honest, whenever I’ve needed something like ddir, I just grabbed tree (which I see now is listed nowhere on this site. šŸ˜” ) They are very similar, as I’m sure you’ll admit.

And given that ddir seems to only offer ASCII characters as output, tree offers a small visual improvement. True, it’s the difference between 1982 and 1983 in console graphics, but it’s there.

ddir’s “help” flag will spit out its man page if you ask, and its few options are there for your perusal. Probably of most interest is the -d flag, which will prune the output (get it? prune? tree? :\ ) to directories only.

ddir is a basic tool and probably something an introductory-level CS student could replicate on a Saturday night as a party trick, but you can probably see a few uses for it. It’s in Debian as just “ddir,” but I don’t see it anywhere in Arch.

And the obvious post for tomorrow will be … tree. šŸ™„

peat: Pete and Repeat are sitting on a fence. …

Here’s a simple python tool that jumps into action when a file changes: peat.


peat is built to execute a command of your choosing, and requires only a list of files to watch as input. As you can see above, probably its most basic use is just to send a message to the screen to announce a change.

But it seems capable of executing almost anything as its target, so you could set it to clean up files, compile a code snippet and run it, or … something completely different.

The syntax to get peat running can be a small challenge; by default peat wants a list separated by whitespace. Check the flags if you want to feed it a list separated by newlines or blank spaces.

I should also mention that in Arch, peat wouldn’t run without calling specifically for python2. On the other hand, it seemed to run without any oddball dependencies or bizarre python libraries, so it may be that it will run well on a vanilla system with no added weight.

I feel like I should mention the long list of file event watchers that are available, so it may be that using python as the basis for a file watcher is still too cumbersome.

And given that their list of features is as wide and long as the list itself, the choice becomes a little more academic. peat is worth investigating if you are comfortable with python and if its advanced handling doesn’t intimidate you. But remember there are many others in the running.

go2: The obvious name for the tool

Last year’s avalanche of directory-switching tools is still reverberating in my ears. I would never assume I found them all, but I am pleased that I’ve found so many. Here’s go2, which is another of the same vein.


go2 is a clever name, since your effectively asking to “go to” some place else. I can appreciate a witty name … although the more I think about it, maybe it’s not so much witty as it is obvious. šŸ™„

Append go2 with a string and it will try to find a directory in your tree that matches it. Give it the -r flag and it will search through all your root directory, which makes it quick and easy to jump across wide chasms in your system.

The first time you run go2, it will fit itself into your .bashrc, and from then on you can access its finer features without any hassle. Aside from that, I saw very little configuration that go2 needed.

If go2 runs into a situation where there is more than one option, it will prompt you for a choice. If your target is too fuzzy, that can take a little while.

go2 is in Debian, but I didn’t see it in Arch or AUR. go2 has a few other options that you might not see in other fast directory-switchers, but I will leave them to you to discover. To be painfully honest, cd and tab completion are usually enough for me.

If you need a little more oomph at the prompt though, this might be helpful.

commacd: Just so long as you know where you’re going

The home page for commacd insists that it is not a fast directory switcher, and so I’ll refrain from calling it that. It does make switching directories a lot faster though.

But I can see where the difference lies. Things like z or j or j2 or autojump or fasd all tried to apply their own algorithms to switching patterns. commacd, on the other hand, trusts you to know where you are and where you want to go, and then takes you there.

commacd, as you have inferred, ties the cd command to the comma sign. In that sense it works exactly the same.

kmandla@6m47421: ~$ , downloads/

kmandla@6m47421: ~/downloads$

But if I have a nested directory and I know where I want to go, commacd suddenly makes it much easier.

kmandla@6m47421: ~$ , /u/s/j

kmandla@6m47421: /usr/share/jack-audio-connection-kit$

On my system, the only path that has the initials u then s then j is /usr/share/jack-audio-connection-kit, and commacd wisely expands my request to match it, and moves me there.

If there’s any doubt, commacd asks for permission.

kmandla@6m47421: ~$ , /u/s/e
0	/usr/share/emacs/
1	/usr/share/enchant/
2	/usr/share/et/
: 2

kmandla@6m47421: /usr/share/et$

A double comma works in reverse, but in the same way as well.

kmandla@6m47421: /usr/share/et$ ,, s

kmandla@6m47421: /usr/share$

Since “share” is in my path and it starts with an s, commacd moved me there. If there is more than one part of my path that starts with that letter, I get moved to the uppermost folder.

kmandla@6m47421: /lib/kernel$ cd /usr/lib/modules/3.16.4-1-ARCH/kernel/net/llc/

kmandla@6m47421: .../3.16.4-1-ARCH/kernel/net/llc$ ,, l

kmandla@6m47421: /usr/lib$ 

Triple commas are wilder, allowing you to jump anywhere within your tree, not just your path. For example. …

kmandla@6m47421: .../3.16.4-1-ARCH/kernel/net/llc$ ,,, sound

kmandla@6m47421: .../modules/3.16.4-1-ARCH/kernel/sound$ 

And that might be the best feature of commacd: jumping well beyond your $PWD to a folder that’s only tangential to where you are at a particular moment.

No more backtracking to a common branch and then tab-completing down to the folder you want. With a little guidance and the reassurance that you know where you are and where you want to go, commacd will just take you there.

There’s no real downside to commacd, except perhaps that you need to have an idea of where you’re going. If you’re just exploring the bowels of /usr/src or looking for an errant file, it won’t help you much to have that kind of flexibility in changing directories. You might be better with the traditional cd command.

commacd “installs” by sourcing with your .bashrc or .bash_profile, so there’s no compiling and no need for a second program. It keeps no logs, has no daemons and doesn’t care if you like sysvinit or systemd. šŸ˜‰ It’s wonderfully transparent and so light you won’t even know it’s there.

I like this one a lot, and it’s definitely worth trying out … just don’t call it a fast directory switcher. šŸ˜‰