Jump to content



Photo

Command line TreeSize-like software?


  • Please log in to reply
12 replies to this topic

#1 moeburn

moeburn

    tracer bullet

  • Joined: 10-March 04
  • Location: Toronto, Ontario

Posted 29 September 2013 - 20:25

Me again!  Last time I was here, I asked if there was a good command-line-based file management program, so that I could move and delete and rename files without having to type in cd and rm and ls all the time, and you guys reccomended Midnight Commander (mc), which works GREAT and was exactly what I was looking for!

 

Well now I'm looking for a program like Midnight Commander that also shows the total size of all the files in a folder, similar to how JAM Software's TreeSize works on Windows.  But it has to be command-line based, because this is all running on my OpenWRT router, which has no display, only SSH and WebUI access. 

 

If there isn't something as fancy and nice as MC, maybe just a simple command I can type to find out the total size of all the files in a folder, like how I can right click on a folder in Windows and click properties to find its size?  Because my router also has a USB HD NAS, and it's getting pretty cluttered and full, and it would be nice to be able to know which folders I should start deleting without having to guess, or add up the total file sizes, or unplug the hard drive and plug it into my other Linux PC (its EXT4) for running TreeSize.

 

Thanks!




#2 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 15
  • Joined: 20-February 11
  • OS: Windows 8.1, BSD Unix
  • Phone: HTC One (Home) Lumia 1020 (Work)

Posted 29 September 2013 - 20:28

Me again!  Last time I was here, I asked if there was a good command-line-based file management program, so that I could move and delete and rename files without having to type in cd and rm and ls all the time, and you guys reccomended Midnight Commander (mc), which works GREAT and was exactly what I was looking for!

If you're really liking Midnight Commander, then I'd probably just go with the Windows version of it.  Same program.
http://sourceforge.n...ojects/mcwin32/
 
There's also a program called Total Commander which is a GUI version that's very similar, not a freebie though if I recall.

For directory sizes, how about "tree /Z"

Can also install the Gnu toolkit and do something like "du -h c:\whatever", as an example.
 
Powershell?  Try something like "Get-ChildItem -Recurse | Measure-Object -Sum Length"

Sure there's a bunch of other ways.

Edit : And bugger me, think I mis-read your question lol, saw Windows and didn't pay attention. But still, look into "du". It works the same. I'm tired, I'll just go away now.

#3 OP moeburn

moeburn

    tracer bullet

  • Joined: 10-March 04
  • Location: Toronto, Ontario

Posted 29 September 2013 - 20:41

If you're really liking Midnight Commander, then I'd probably just go with the Windows version of it.  Same program.
http://sourceforge.n...ojects/mcwin32/
 
There's also a program called Total Commander which is a GUI version that's very similar, not a freebie though if I recall.

For directory sizes, how about "tree /Z"

Can also install the Gnu toolkit and do something like "du -h c:\whatever", as an example.
 
Powershell?  Try something like "Get-ChildItem -Recurse | Measure-Object -Sum Length"

Sure there's a bunch of other ways.

Edit : And bugger me, think I mis-read your question lol. But still, look into "du". It works the same.

 

du works great, thanks!  I've never heard of it, I didn't even know that this busybox came with it.  It certainly wasn't listed under the "built-in commands" after typing in 'help'.  But it works great, and accepts the same flags (like -h for human readable) as df!  



#4 netsysllc

netsysllc

    Neowinian

  • Joined: 01-April 13

Posted 29 September 2013 - 20:55

Here is a powershell script https://github.com/j...ey/TreeSizeHtml that makes a nice html report



#5 OP moeburn

moeburn

    tracer bullet

  • Joined: 10-March 04
  • Location: Toronto, Ontario

Posted 29 September 2013 - 20:56

Here is a powershell script https://github.com/j...ey/TreeSizeHtml that makes a nice html report

 

Wtf is powershell?  Isn't that a Windows thing?  This is for Linux.



#6 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 15
  • Joined: 20-February 11
  • OS: Windows 8.1, BSD Unix
  • Phone: HTC One (Home) Lumia 1020 (Work)

Posted 29 September 2013 - 21:03

4jsz.png



#7 OP moeburn

moeburn

    tracer bullet

  • Joined: 10-March 04
  • Location: Toronto, Ontario

Posted 29 September 2013 - 21:38

4jsz.png

 

I don't understand, who exactly are you making fun of?  I posted a question about Linux, in a Linux subforum.



#8 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 15
  • Joined: 20-February 11
  • OS: Windows 8.1, BSD Unix
  • Phone: HTC One (Home) Lumia 1020 (Work)

Posted 29 September 2013 - 21:49

I don't understand, who exactly are you making fun of?  I posted a question about Linux, in a Linux subforum.

Me and the other guy, who somehow saw a Linux question in the Linux forum and comes up with Windows answers.



#9 +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 29 September 2013 - 22:06

If you just want the size of a single directory - not the size of every file and directory in the tree - you can pass du the flag --total and pipe its output to tail to get the size of that directory by itself. For example, I most frequently use du to get the size of the current directory using the following command:

du -h --total | tail -n 1


#10 +Majesticmerc

Majesticmerc

    Resident Idealist

  • Tech Issues Solved: 8
  • Joined: 24-August 05
  • Location: United Kingdom
  • OS: Arch Linux / Win 7
  • Phone: HTC One X

Posted 29 September 2013 - 22:08

The du command is likely what you're after. Used like this it can give you the size of all files (and folders) inside a folder...
 
$ du -ah /opt/spotify
4.0K   /opt/spotify/libs
53M    /opt/spotify/spotify-client/libcef.so
4.0K   /opt/spotify/spotify-client/linklibs.sh
4.0K   /opt/spotify/spotify-client/unregister.sh
7.8M   /opt/spotify/spotify-client/Data/apps.zip
2.3M   /opt/spotify/spotify-client/Data/resources.zip
11M    /opt/spotify/spotify-client/Data
216K   /opt/spotify/spotify-client/licenses.xhtml
3.1M   /opt/spotify/spotify-client/devtools_resources.pak
26M    /opt/spotify/spotify-client/spotify
648K   /opt/spotify/spotify-client/chrome.pak
4.0K   /opt/spotify/spotify-client/spotify.desktop
4.0K   /opt/spotify/spotify-client/readme.fedora
4.0K   /opt/spotify/spotify-client/changelog
4.0K   /opt/spotify/spotify-client/register.sh
4.0K   /opt/spotify/spotify-client/locales/en-US.pak
8.0K   /opt/spotify/spotify-client/locales
12K    /opt/spotify/spotify-client/Icons/spotify-linux-128.png
4.0K   /opt/spotify/spotify-client/Icons/spotify-linux-48.png
56K    /opt/spotify/spotify-client/Icons/spotify-linux-512.png
4.0K   /opt/spotify/spotify-client/Icons/spotify-linux-24.png
4.0K   /opt/spotify/spotify-client/Icons/spotify-linux-32.png
4.0K   /opt/spotify/spotify-client/Icons/spotify-linux-22.png
24K    /opt/spotify/spotify-client/Icons/spotify-linux-256.png
8.0K   /opt/spotify/spotify-client/Icons/spotify-linux-64.png
4.0K   /opt/spotify/spotify-client/Icons/spotify-linux-16.png
124K   /opt/spotify/spotify-client/Icons
92M    /opt/spotify/spotify-client
92M    /opt/spotify
You can also use the --max-depth=1 option to prevent the command from descending into directories...
 
$ du -ha --max-depth=1 /opt/spotify
4.0K	/opt/spotify/libs
92M	/opt/spotify/spotify-client
92M	/opt/spotify
EDIT: Ninja'd by xorangekiller again :shiftyninja:.

#11 +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 29 September 2013 - 22:14

EDIT: Ninja'd by xorangekiller again :shiftyninja:.

I noticed that in the "switch, no output" thread too. In both cases you posted exactly 2 minutes after me (according to the forum software), and we had more-or-less the same thing to say. Great minds think alike?



#12 +Majesticmerc

Majesticmerc

    Resident Idealist

  • Tech Issues Solved: 8
  • Joined: 24-August 05
  • Location: United Kingdom
  • OS: Arch Linux / Win 7
  • Phone: HTC One X

Posted 29 September 2013 - 22:17

I noticed that in the "switch, no output" thread too. In both cases you posted exactly 2 minutes after me (according to the forum software), and we had more-or-less the same thing to say. Great minds think alike?


Dang right they do! :D

#13 +DonC

DonC

    Neowinian

  • Joined: 16-August 07
  • Location: England

Posted 29 September 2013 - 23:05

Don't forget the --max-depth option in du to limit the number of subdirectories reported.