You are not logged in.

#1 2012-03-27 20:06:21

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

dfc: Display file system space usage using graph and colors

Hi all,

I wrote a little tool, somewhat similar to df(1) which I named dfc.

To present it, nothing better than a screenshot (because of colors):
1332878015.png
1332878045.png

And there is a few options available (as of version 3.0.0):

Usage:  dfc [OPTIONS(S)] [-c WHEN] [-e FORMAT] [-p FSNAME] [-q SORTBY] [-t FSTYPE]
    [-u UNIT]
Available options:
    -a    print all mounted filesystem
    -b    do not show the graph bar
    -c    choose color mode. Read the manpage
        for details
    -d    show used size
    -e    export to specified format. Read the manpage
        for details
    -f    disable auto-adjust mode (force display)
    -h    print this message
    -i    info about inodes
    -l    only show information about locally mounted
        file systems
    -m    use metric (SI unit)
    -n    do not print header
    -o    show mount flags
    -p    filter by file system name. Read the manpage
        for details
    -q    sort the output. Read the manpage
        for details
    -s    sum the total usage
    -t    filter by file system type. Read the manpage
        for details
    -T    show filesystem type
    -u    choose the unit in which
        to show the values. Read the manpage
        for details
    -v    print program version
    -w    use a wider bar
    -W    wide filename (un truncate)

If you find it interesting, you may install it from the AUR: http://aur.archlinux.org/packages.php?ID=57770
(it is also available on the archlinuxfr repository for those who have it enabled).

For further explanations, there is a manpage or the wiki on the official website.

Here is the official website: http://projects.gw-computing.net/projects/dfc

If you encounter a bug (or several!), it would be nice to inform me. If you wish a new feature to be implemented, you can always ask me by sending me an email (you can find my email address in the manpage or on the official website).

Cheers,

Rolinh

Last edited by Rolinh (2012-05-31 00:36:48)

Offline

#2 2012-03-28 12:33:38

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: dfc: Display file system space usage using graph and colors

Looks great, works great. Thanks!!

Offline

#3 2012-03-29 20:10:12

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

Thanks smile

Version 2.1.0 is out. I let you read the announce if you want to know what's new.

Offline

#4 2012-03-30 01:27:14

bencahill
Member
Registered: 2011-03-20
Posts: 40

Re: dfc: Display file system space usage using graph and colors

This is...was awesome. I finally configured the perfect filesystem usage: dfc -t|grep --color=never -v '/dev$\|/run$\|/dev/shm$\|^/dev/sda2'

Then the upgrade. There were the decently major changes (e.g. -t changing from 'don't show type' to 'filter by type'), but I suppose this is to be expected from such young software. wink

Anyway, I now cannot find any way of having colored output showing only some mounts (that aren't all the same type), without modifying the code.

Two suggestions:
1. Introduce a --color option like ls and grep (--color=WHEN, where WHEN is always,never,auto)
2. Change -t to be able to filter multiple types (-t ext4,ext3,etc), and support negative matching (! -t tmpfs,devtmpfs,etc)

Both of these would be awesome, if you have time. smile I've simply reverted for now.

By the way, awesome software. wink

P.S. I'd already written this up before I noticed the part in your post about sending feature requests to your email. I decided to post it anyway, as I figured others could benefit from your answer as well. Please forgive me if this is not acceptable. smile

Offline

#5 2012-03-30 06:37:02

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

bencahill wrote:

There were the decently major changes (e.g. -t changing from 'don't show type' to 'filter by type'), but I suppose this is to be expected from such young software. wink

I know I changed the options a lot with 2.1.0 release. I thought it would be better to have -t for filtering and -T for printing the file system type so someone using the original df would not be surprised.
I'm sorry for the inconvenience. There should not be any changes like this one in the future though but I thought it was needed (especially because of the unit options).

bencahill wrote:

Anyway, I now cannot find any way of having colored output showing only some mounts (that aren't all the same type), without modifying the code.

Two suggestions:
1. Introduce a --color option like ls and grep (--color=WHEN, where WHEN is always,never,auto)

Ok, I'll implement this one for 2.2.0 release wink It'll be more like "-c always", "-c never" and "-c auto" (default) because I do not use long options but I think this would be OK, right?

bencahill wrote:

2. Change -t to be able to filter multiple types (-t ext4,ext3,etc), and support negative matching (! -t tmpfs,devtmpfs,etc)

This was already planned for 2.2.0 release wink

bencahill wrote:

Both of these would be awesome, if you have time. smile I've simply reverted for now.

This is what I would have suggested.

bencahill wrote:

By the way, awesome software. wink

Thanks smile I'm glad you like it!

bencahill wrote:

P.S. I'd already written this up before I noticed the part in your post about sending feature requests to your email. I decided to post it anyway, as I figured others could benefit from your answer as well. Please forgive me if this is not acceptable. smile

This is perfectly fine smile Moreover, I seem to have some troubles with my e-mail addressee... sad So it's actually better that you posted your requests here!

Offline

#6 2012-03-30 09:01:16

null
Member
Registered: 2009-05-06
Posts: 398

Re: dfc: Display file system space usage using graph and colors

Nice app, but I run into a problem: If I try to run dfc as a normal user I get this:

Error using statvfs on /root/.gvfs
with this error code : Permission denied

Which is only natural since the user has no rights in /root...

Everything works great as root.

Offline

#7 2012-03-30 09:16:17

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

Ok, This is a bug smile

I haven't thought about that.
I'll fill a bug issue and fix it for the next release.

Last edited by Rolinh (2012-03-30 09:16:55)

Offline

#8 2012-03-30 09:20:26

null
Member
Registered: 2009-05-06
Posts: 398

Re: dfc: Display file system space usage using graph and colors

Awesome! smile

Offline

#9 2012-03-30 13:51:50

bencahill
Member
Registered: 2011-03-20
Posts: 40

Re: dfc: Display file system space usage using graph and colors

Rolinh wrote:

I know I changed the options a lot with 2.1.0 release. I thought it would be better to have -t for filtering and -T for printing the file system type so someone using the original df would not be surprised.
I'm sorry for the inconvenience. There should not be any changes like this one in the future though but I thought it was needed (especially because of the unit options).

Makes sense. Thanks for the explanation. smile

Rolinh wrote:
bencahill wrote:

Introduce a --color option like ls and grep (--color=WHEN, where WHEN is always,never,auto)

Ok, I'll implement this one for 2.2.0 release wink It'll be more like "-c always", "-c never" and "-c auto" (default) because I do not use long options but I think this would be OK, right?

Sounds perfect!

Rolinh wrote:
bencahill wrote:

Change -t to be able to filter multiple types (-t ext4,ext3,etc), and support negative matching (! -t tmpfs,devtmpfs,etc)

This was already planned for 2.2.0 release wink

Awesome.

Rolinh wrote:

This is perfectly fine smile Moreover, I seem to have some troubles with my e-mail addressee... sad So it's actually better that you posted your requests here!

Goodie!

Thank you for your awesome and prompt reply. smile

Offline

#10 2012-03-30 14:00:07

ne
Member
Registered: 2012-03-25
Posts: 15

Re: dfc: Display file system space usage using graph and colors

Sorting options would be nice. Other than that I really like it.

Offline

#11 2012-03-30 14:23:45

NeOnsKuLL
Member
From: Havana, Cuba
Registered: 2005-03-29
Posts: 117

Re: dfc: Display file system space usage using graph and colors

Incredible dude! Really nice work. Thanks


Intel Core 2 Duo E8400 3.0 GHz | 2x1GB 667MHz | 250+750GB Seageate SATAII | Samsung 19" TFT 1440x900
Openbox + obmenugen + PyTyle | bmpanel2 | oblogout | conky | pyBgSetter (with Esetroot as backend)
Projects: obmenugen, pyBgSetter

Offline

#12 2012-03-30 19:11:38

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

Alright, version 2.2.0 is out  smile

I think the only thing that you requested here that is not yet implemented is the negative matching for filtering on file system type. I will probably implement it for the next release.

I'm glad you like it smile

@ne: I could implement sorting but this would mean a lot of work. Maybe sometimes in the future. I will just consider it a low priority feature. wink

Offline

#13 2012-03-30 19:24:28

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: dfc: Display file system space usage using graph and colors

Very nice! The filtering of multiple types is especially useful! Well done!


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#14 2012-03-30 20:43:09

bencahill
Member
Registered: 2011-03-20
Posts: 40

Re: dfc: Display file system space usage using graph and colors

Rolinh wrote:

Alright, version 2.2.0 is out  smile

Whoa! Quite a release cycle you've got there. wink

Thanks for all your hard work. I'll be watching for the ! -t functionality, as that will be optimal for my case. dfc is already head and shoulders above everything else I've tried.

Thanks again, and don't work too hard! tongue

Offline

#15 2012-03-30 22:34:29

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

bencahill wrote:

Whoa! Quite a release cycle you've got there. wink

It probably won't last. tongue I will probably come to a point where adding features would make dfc bloated. I prefer to remain KISS (which is probably the main reason why I love Arch btw).

bencahill wrote:

Thanks for all your hard work.

Instead of watching dumb stuff on TV, I prefer coding. smile Really, this is just a fun task for me so I would not use the word "work" to describe it. And it appears that it can prove useful to some others apparently.

bencahill wrote:

I'll be watching for the ! -t functionality, as that will be optimal for my case.

Expect it for 2.3.0 release. wink

bencahill wrote:

dfc is already head and shoulders above everything else I've tried.

Woaw, really? Thanks a lot, this is such a compliment!!

Offline

#16 2012-03-31 14:51:43

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

2.3.0 brings negative matching support, string truncation when they're too long and auto-adjustment of the output based on terminal width (read announcement).

I hope it brings all the features that were missing.

By the way, If you like it, don't forget to vote for it on the AUR wink

Cheers

Offline

#17 2012-03-31 14:57:46

bencahill
Member
Registered: 2011-03-20
Posts: 40

Re: dfc: Display file system space usage using graph and colors

Rolinh wrote:

2.3.0 brings negative matching support, string truncation when they're too long and auto-adjustment of the output based on terminal width (read announcement).

I hope it brings all the features that were missing.

By the way, If you like it, don't forget to vote for it on the AUR wink

Cheers

Sweet. Now I have the most awesome disk-listing output evar!

Voting now.

Offline

#18 2012-04-03 23:24:07

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

Ï released version 2.4.0 and 2.5.0.
2.4.0 was about FreeBSD support (it is available in the ports) while 2.5.0 brings Mac OS support.

However, if I mention this here, this is because a few bugs were fixed in 2.5.0 and a new option appeared (avoid path name truncation) that we may all benefit from.

I think I can rest a moment now.

Offline

#19 2012-04-15 18:03:47

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

Hey all,

I uploaded a git version of dfc on the AUR. Find it here: http://aur.archlinux.org/packages.php?ID=58499
Of course, this is a development version so it includes all possible disagreements that come when a software is in such a stage.
The reason I did this is because I am close to finish version 3.0.0 and I need beta-testers. I thought it would be more convenient for you to test it this way.
Why do I need beta-testers? Well, because currently about 1300 lines of code have already been added since version 2.5.0 was released and they might hide some bugs (and of course, I would like dfc 3.0.0 to be bug free tongue ).

If you could test the new options heavily and report any bug here, I would appreciate it a lot.
By the way, here are the new options implemented as of today:
- new option to export data to csv (html and tex is planned)
- new option to sort the output (based on fsname, type or mountpoint)
- improved auto-adjust feature (this one needs special attention)
- introduction of an optional configuration file that allows you to change colors and symbol used to draw the graphe
- new option that allows to perform filtering based on fs

Also, I started to implement translation support. Currently, only dfc program can be translated (I still need to implement a way to translate manpage and configuration file easily).
When I'll be done implementing translation support, I'll be glad to receive translations as I can only translate it into french (and perhaps german). smile

Cheers,

Offline

#20 2012-04-16 04:06:20

dodo3773
Member
Registered: 2011-03-17
Posts: 801

Re: dfc: Display file system space usage using graph and colors

Thanks for the application. I really like it. I do have one feature request: The ability to type "--help" for additional usage instead of / in addition to "-h".

Offline

#21 2012-04-16 06:13:17

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

dodo3773 wrote:

Thanks for the application. I really like it.

Thanks and you're welcome. wink

dodo3773 wrote:

I do have one feature request: The ability to type "--help" for additional usage instead of / in addition to "-h".

I'm afraid my answer will not please you.
The --help kind of stuff refers to long options which means I need to use the getopt_long(3) function which is a GNU extension.
So, one reason for me not to implement such a thing is that dfc source code is "GNU extension free" and I would like to keep it this way.
Another reason is that dfc runs on *BSD systems too. Official tools (like mount(1), df(1), etc.) do not have long options on these systems.
Finally, one reason which is much more personal: I think that long options is a dumb idea. With simple options and sub-options, there is more than enough to fit the needs.

Therefore, I will not implement this feature. Is it a huge deal for you?

Offline

#22 2012-04-16 06:32:19

dodo3773
Member
Registered: 2011-03-17
Posts: 801

Re: dfc: Display file system space usage using graph and colors

Rolinh wrote:

dfc source code is "GNU extension free" ...
dfc runs on *BSD systems too... do not have long options on these systems.
Is it a huge deal for you?

I suspected this was related. It is not a huge deal for me. I can just write a function if it really bothers me.

Finally, one reason which is much more personal: I think that long options is a dumb idea. With simple options and sub-options, there is more than enough to fit the needs.
Therefore, I will not implement this feature.

I did not think about it as dumb or intelligent. I was just thinking in terms of consistency. I understand your position as this being a cross-platform issue though. Thank you for the quick response and explanation.

Offline

#23 2012-04-16 06:50:40

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

dodo3773 wrote:

I did not think about it as dumb or intelligent. I was just thinking in terms of consistency. I understand your position as this being a cross-platform issue though. Thank you for the quick response and explanation.

I will not hide the fact that I have also been asked to make dfc options perfectly df compliant (I guess this is an extension of the "consistency" idea). My answer is the same for about the same reasons plus I do not see dfc as a df replacement by the fact that this is not a standard tool on POSIX systems and thus it shall not be used in scripts that are supposed to be distributed/spread elsewhere.
Moreover, dfc has many more options than df.

Offline

#24 2012-04-16 11:09:01

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: dfc: Display file system space usage using graph and colors

I love dfc so, with all due respect, aren't a lot of these new features completely unnecessary? I hate how often the word "bloat" is carelessly thrown around on these forums (sometimes new features *are* desirable) but nonetheless, for a commandline tool, I think it would be better to defer this functionality to other programs.

Rolinh wrote:

- new option to export data to csv (html and tex is planned)

...pipe the output into an awk script to format it as csv, html or tex

- new option to sort the output (based on fsname, type or mountpoint)

fsname:

dfc -nf | sort -k1

type:

dfc -Tnf | sort -k2

mountpoint:

dfc -nf | sort -k6

(and add a -c "always" flag in there to retain color)

- new option that allows to perform filtering based on fs

grep?

Offline

#25 2012-04-16 11:59:04

Rolinh
Member
From: Switzerland
Registered: 2011-05-07
Posts: 144
Website

Re: dfc: Display file system space usage using graph and colors

jakobcreutzfeldt wrote:

I love dfc so, with all due respect, aren't a lot of these new features completely unnecessary? I hate how often the word "bloat" is carelessly thrown around on these forums (sometimes new features *are* desirable) but nonetheless, for a commandline tool, I think it would be better to defer this functionality to other programs.

I totally understand your point of view.
So, let me answer in detail:

First, I do no think those new options make dfc bloated (I justify why I implemented them below). If there are not used, they will not slow down the execution of dfc. If you do not want to use them and use command line tool instead, this is perfectly fine so you should just do it and ignore those new options. However, those features were requested by some users and I did not see any reason for not implementing them.
In the same idea, a configuration file was requested. I personally do not use it and if you too do not, this will not slow down dfc execution at all (there is only a test to check if a configuration file exists or not; by the way, configuration file parsing does not take much time at all).

jakobcreutzfeldt wrote:

...pipe the output into an awk script to format it as csv, html or tex

As you said, you need an awk script for this. Not everyone is familiar enough with awk or similar tools to do this. Personnally, I do not think I could write one so easily.

jakobcreutzfeldt wrote:

fsname:

dfc -nf | sort -k1

type:

dfc -Tnf | sort -k2

mountpoint:

dfc -nf | sort -k6

(and add a -c "always" flag in there to retain color)

This is one way to do it. But what if you want the header to be displayed and the sum at the bottom?

jakobcreutzfeldt wrote:

grep?

This one may be the hardest one to justify. However, sorting using built in option should be much faster as it uses a merge sort algorithm on a linked list structure, all of this in C. Plus it was fun for me to code. tongue

Personally, I do not think those new options make dfc bloated. It's easy to ignore some options. Plus, it still performs fast and has not slow down at all. You can compare the execution time of latest development version and 2.5.0 version.

Last, I love the KISS principle (one of the reasons that make me use Archlinux since 2009 actually) and I will never want dfc to be bloated. Probability of new options after 3.0.0 release is very low as I cannot see any that would be useful unless a user presents me one.

I hope my this answers your post well. wink

Offline

Board footer

Powered by FluxBB