Command line TreeSize-like software?


Recommended Posts

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!

Link to comment
https://www.neowin.net/forum/topic/1179571-command-line-treesize-like-software/
Share on other sites

  On 29/09/2013 at 20:25, moeburn said:

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.net/projects/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.

  On 29/09/2013 at 20:28, Max Norris said:

If you're really liking Midnight Commander, then I'd probably just go with the Windows version of it.  Same program.

http://sourceforge.net/projects/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!  

  On 29/09/2013 at 21:38, moeburn said:

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.

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

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:.
  On 29/09/2013 at 22:08, Majesticmerc said:

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?

  On 29/09/2013 at 22:14, xorangekiller said:

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Hahaha! I've been arguing with my dad for 10 years (he's pro-Tesla, I'm impartial as I don't trust a lot of the people and their tech in these robotaxis) about this whole charade. His continued argument is the cost factor (economies of scale principle) and the associated technology (different dependencies of which reduced production cost is a potential outcome thus feeding into the reduced cost argument). And my rebuttal is the broad-market trust factor -- it's often not the most innovative or first-mover that wins (Uber and Tesla have been arguing/investing in autonomous vehicles forever) but rather the option that builds the most trust amongst the commonwealth. VW and Toyota are not the first or best or cheapest cars on the road, but they've built a long of continued trust to the scales of being the largest automakers by volume worldwide. Supercar makers have the highest profit margins, Tesla has the highest stock price, but VW and Toyota have the sales volumes. As it stands, the writing is on the wall... No matter what advantages Tesla had in their ambitions, they have an even-longer road to repair public trust than any other robotaxi provider (foreign or domestic). If the trend continues, everyone will realise that their market valuation is based on their non-automotive efforts (including not robotaxis or consumer humanoids).
    • Or just use Linux and live free. For the anti-Linux brigadiers reading this, this is the part where you go: Nooo! I love being digitally abused by Microsoft 😡😡 /s
    • Windows 10 KB5061087 fixes incorrect version reporting, Start menu bugs, and more by Taras Buria Following the news about a free year of Windows 10 security updates (there are some strings attached), Microsoft is releasing a new non-security update for its decade-old operating system. Today, Microsoft shipped KB5061087 (build number 10945.6036) with a pretty long list of fixes. In today's update, Windows 10 users get fixes for the Settings app incorrectly reporting Windows version, issues with Multi-Function printers with dual protocol interface, disappearing jump list in the Start menu, and other bugs. Here is the changelog: [Mobile Operator Profiles] Updated: Country and Operator Settings Asset (COSA) profiles. [App Platforms and Frameworks] Fixed: An issue affecting Component Object Model (COM) functionality on Windows platforms. Remote COM activations were failing with error 0x8001011. Updated: The version of the curl tool included in Windows is updated to v8.13.0. [Authentication Platform] Fixed: An issue affecting the device registration in Entra ID Windows Account Manager (WAM) plugin. [Input and Composition] Fixed: An issue affecting the complete removal of unused language packs and Feature on Demand (FOD) packages. This issue led to unnecessary storage use and increased Windows update installation time. [Print and Peripherals] Fixed: An issue affecting USB-connected Multi-Function printers with dual protocol interfaces. Scanning failed and prevented using the built-in scanning functionality in the operating system. [Start Menu] Fixed: An issue causing jump lists to disappear from the Start Menu. Fixed: An issue where the Start Menu was not starting after installing an update. [WinSaS] Fixed: Settings > System > About incorrectly shows version 2009 instead of version 22H2. Change of behavior: To maintain DMA compliance in the European Economic Area (EEA), when a new default browser is set, it is automatically pinned to the Taskbar and Start menu. Change of behavior: Associates HTTP and .pdf file types when setting default browser. [Servicing] Fixed: An issue where Kiosk devices using the ForceAutoLogon configuration and Shift Override might stop responding with a blue screen after being locked and unlocked by support administrators. [File Server] Fixed: An issue where the system may stop responding when acknowledging an Oplock break request on resources located on SMB shares. Known issues include a single bug with Noto fonts appearing blurry in Chromium-based browsers such as Edge or Chrome. For now, the only fix is to set your screen scaling to 125% or higher. As usual, feel free to skip KB5061087 if you do not need any of those fixes. Non-security updates are optional, and they eventually arrive with monthly Patch Tuesday updates. You can get KB5061087 from Windows Update or the Microsoft Update Catalog using this link.
    • Governments should be encouraging users to move to Linux instead of creating unnecessary eWaste with great and still-capable machines. Of course, that's presuming they actually give a damn after all their talks of "global warming"/"climate change"/"carbon capture" and those weren't all just PR talks.
    • Except now you need to use a MSA account to do that... one step closer to Windows 11
  • Recent Achievements

    • Week One Done
      DrRonSr earned a badge
      Week One Done
    • Week One Done
      Sharon dixon earned a badge
      Week One Done
    • Dedicated
      Parallax Abstraction earned a badge
      Dedicated
    • First Post
      956400 earned a badge
      First Post
    • Week One Done
      davidfegan earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      605
    2. 2
      ATLien_0
      225
    3. 3
      Michael Scrip
      168
    4. 4
      +FloatingFatMan
      154
    5. 5
      Xenon
      137
  • Tell a friend

    Love Neowin? Tell a friend!