How to list folder sizes in Terminal

I pulled a command off the Internet, but it does not run correctly in my Terminal (using ZSH):
find $1 -type f -print0 | xargs -0 stat -f'%z' | awk '{b+=$1} END {print b}' | awk '{ sum=$1 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}’
Would anyone be willing to take a look at this and see if you can get it to run in ZSH, or provide another solution that meets the requirement?
Thank you.

Thank you, but after some experimentation, this resolved my issue:
sudo du -kshc *
Output:
8.6G
Applications
3.4G
Library
  0B
Network
3.9G
System
140G
Users
4.0K
Volumes
2.6M
bin
  0B
cores
4.5K
dev
4.0K
etc
1.0K
home
8.0M
mach_kernel
1.0K
net
4.2G
private
980K
sbin
4.0K
tmp
384M
usr
4.0K
var
160G
total

Similar Messages

  • How to check folder sizes of the root directory on my VPS/Dedicated server via Terminal?

    Hi,
    I have following issue.
    I have a VPS with Linux OS and I'd like to check size of the folders as well as remaining space on my server.
    How can I do that via Terminal?
    I would appreciate any input.

    login into your VPS server via terminal and cd into the root of your hosted space.  Then use the df -h command to see the listing
    for i.e.
    df -h /volumes/volume_1
    Filesystem             Size   Used  Avail Capacity iused      ifree %iused  Mounted on
    //john@ds00/volume_1  457Gi   12Gi  445Gi     3%       0 18446744073709551615    0%   /Volumes/volume_1
    for you it would be something like:
    df -h [email protected]/share (ip address)

  • How to get folder size in bytes

    Hi all,
    Is there a easy way to get folder size in bytes?  I don't want to check each file in it and then add them up.
    Thanks for any help.
    Anne

    Years ago, I found my home PC was lacking disk space and could not exaplain where all of the space went.
    At the same time I was teaching myslef how to use the Picture control and Windows did not allow you to check the size of a folder and it sub-folders. So I used that situation to learn about the picture control and LV at the same time.
    It worked and ran but very slowly.
    Soon after Greg McKaskle was putting together the first version of "The Good The Bad and The Ugly" and was looking for fodder to beat up. I offered and he accepted. When the time came for the presentation, my code was chosen as "The bad" since I had not learned how to do a cluster sort at that time so I wrote my own version of a bubble sort (the VI presents a Pie Chart of disk usage and clcik on the sectors of the Pie Chart allowed you to drill down so I hd to sort by sizes).
    So why am I telling you this long boring story?
    That code is attached for you to look at laugh and tell me how dumb I was.
    Feel free to beat me up. It can't be any worse than the abuse I got from Greg (I felt like I was being raped).
    Have fun!
    Ben
    Code is probably 6 or thereabouts. "Disk_Utility" is top level. Remember this is an example of how NOT to code.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    DIsk_Pie_Utility.zip ‏162 KB

  • How to "list folder" sorted by date

    I can get the list of items in a folder but it always is organized alphabetically by name even if the folder is in list form and sorted by date. Is there any easy way to get the list of items sorted by date (or some other property)?
    Of course, I can go back and write a sorting algorithm based on these other properties, but I don't want to have to write more...
    Thanks
    Kraig

    Yes, the looping would be necessary in this case. As an alternative you could use a shell command:
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "Finder"
    set x to POSIX path of (desktop as alias) -- in my case "/Users/michaelhenley/Desktop/"
    set y to paragraphs of (do shell script "ls -t " & quoted form of x) -- "-t" sorts by modification date. type "man ls" in Terminal.app for more info
    end tell</pre>

  • How to list AUR packages in terminal with yaourt or other helper?

    I can list packages I have installed from AUR, for example to find all the developer components of Xfce that I have installed, I can run the following command:
        pacman -Qim | grep -E "Name           : xf".+devel
    Which outputs:
        Name           : xfce4-appfinder-devel
        Name           : xfce4-dev-tools-devel
        Name           : xfce4-panel-devel
        Name           : xfce4-session-devel
        Name           : xfce4-settings-devel
        Name           : xfdesktop-devel
        Name           : xfwm4-devel
    But, how do I find out if there are other packages that match the same regex pattern available in the AUR, maybe using yaourt? When I try:
        yaourt -Si | grep -E "Name           : xf".+devel
    I get no output. When I don't include .+devel, I find out that none of the AUR packages are included. If I try to force it to search the AUR by including -a, it says that's not a valid option.
    So, how do I search the AUR from the terminal?

    falconindy wrote:
    cower transparently supports regex -- but not thanks to the AUR. In reality, the query "xf.*-devel" is actually asking the AUR to search for "xf". The returned results are filtered against the regex "xf.*-devel" and out pops magic.
    Yaourt doesn't do this.
    I saw that, but Yaourt should be able to simply query the AUR without it trying to install stuff, but how? Does anyone know? I knew yaourt didn't support regex, that's why I was piping the output to grep. It worked for pacman, and works for yaourt when it uses pacman, but I can't figure out how to get it to return the contents of the AUR so I can pipe those contents through grep.

  • How to create folder inside User Meetings using XML API

    Hello,
    I have appreciative if some one help me on below task
         I have created on application for user meeting.
         In that I want dynamic folder creation as per user need or how to list folder that related to login user or say user session.
    Waiting for reply,
    Thanks,
    Gaurang Jadav
    Project Leader
    iFlair Web Technologies Pvt. Ltd.
    www.iFlair.com 
    US: +1-312-235-2876 UK: +44-020-7193-4712

    Hello buddy,
    https://yourdomain.na4.acrobat.com/api/xml?action=sco-update&type=folder&name=gaurang&url-path=gaurangfolder &folder-id=827379162&depth=1
    you need to change yourdomain & 827379162(folder id).
    Hope this will help you in further process
    Good luck
    Regrd,
    Gaurang Jadav

  • How to restrict the size of folder in KM?

    Hi All,
    How to restrict the size of folder in KM?
    Suppose I allocated 1 personal folder to every SAP KM Folder. Can I restrict the size of folder with do not allowed the uploaded file to be exceeded certain capacity?
    Thanks & Regards,
    zhixuen.

    Hi,
    Refer this [http://help.sap.com/saphelp_nw70/helpdata/en/62/468698a8e611d5993600508b6b8b11/content.htm]
    Also chk.
    https://forums.sdn.sap.com/thread.jspa?threadID=80571
    https://forums.sdn.sap.com/thread.jspa?threadID=80326
    https://forums.sdn.sap.com/thread.jspa?threadID=80145
    http://weblogs.sdn.sap.com/pub/wlg/3219
    Regards
    Baby

  • How to set folder windows size not to change?

    Hi,
    I'm having a problem with displaying folder sizes in the finder, I open my applications folder, centre it, stretch it to display how I like, use the view options for icon size, spacing etc; great, just how I like it.
    Trouble is, when I next open the folder it is centred but much smaller! Is threre a way to keep it as I want?
    Thanks in advance :0)
    B

    The Buffster wrote:
    Hi,
    I'm having a problem with displaying folder sizes in the finder, I open my applications folder, centre it, stretch it to display how I like, use the view options for icon size, spacing etc; great, just how I like it.
    Trouble is, when I next open the folder it is centred but much smaller! Is threre a way to keep it as I want?
    Thanks in advance :0)
    Have you clicked "use as defaults" at the bottom of the preference window?

  • File / Folder size... How do Finder gets it?

    Hi there!
    While checking some of my hardrives for sucessfull shell script execution backups, i noticed that Finder took a loooot of time to provide the info about the Folder / File size on the Information window, while a simple ls -l could provide on the fly values regarding file or folder size, as always, fast simple and faithfull unix mindset!
    Well, that makes me wonder, how does Finder calculates those values? Anyone got an hint?
    Does it make it all by himself, if so. WHY? Been an "posix" system, shouldn't he be using whats already provided by its *nix heritage?
    In this case, the value is already there, why don't use it and simply parse it to the desired format (MB / GB / TB)?
    Maybe this could be only one of several features (GUI) that could improve it's performance from being more "conscious" of the system natively provided "toolkit".
    Please, this is only my humble thouhgts on this, and please do shut me up if totally wrong!
    Hope to get some nice and interesting feedback from the OS X community!
    If there's a better spot to start this kind of discussion, please do mention it, i will appreciate it!
    Best regards.

    Properties. Short Cuts, Change Icon resolved the issue after restarting. Problem resolved.. Thank you for all the help Dwain

  • How to get the personal folder size

    Hi,
    I'm trying to develop a method for define the maximum size of personal documents folder. I'm changing the Upload Command, and I want to know if its possible to get the current size of the personal documents folder for the user that is trying to upload the document.
    For this moment, I've got the current UserID, and I have created an RID with the path "userhome/UserID/Personal Documents", but now I don't know how to get the size of this folder!!!!
    Thanks to all.
    Arnau Rovira

    Originally Posted by NanLau
    Hi,
    Does anyone know how to get the current size of Mailbox and Archive by using GW api?
    Can anyone answer this? Thanks.

  • How to define the size of private folder in Easy DMS?

    Hi,
    I have to ristrict the user to keep  the data in private folder after the maximum limit
    please help me how to define the private folder size in easy DMS.
    after the limit user is not able to keep data in private folder.

    Hi,
    This can be done in SAP Customization / SPRO
    Pl. check :
    Cross-Application Components>Document Management>Control Data>Define Document types
    Here the size limit can be defined.
    Also check : http://scn.sap.com/community/plm/document-management/blog/2014/06/20/how-to-create-dir-and-document-type-in-dms
    Hope this helps
    Regards,
    Remi

  • How can I get Finder to recalculate folder sizes?

    How can I get the Finder to recalculate folder sizes?
    I had a folder called "architecture 600," with lots of large files in it; when I checked it with command-i, the Finder told me it contained 691 MB of information.
    I then moved most of the files to another folder (not just to the desktop, but to a new folder in the Documents folder). However, when I select "architecture 600" and press command-i, Finder still tells me it's 691 MB. When I open up "architecture 600," there are only three items in it, which total 305 MB.
    I've tried removing and re-adding the size column in the enclosing folder, and turning off and then back on the "calculate all sizes" checkbox in the view options (command-j) for the enclosing folder. The finder still gets the size of the folder wrong.
    This is happening with lots of folders, not just "architecture 600," by the way.

    This has been a bug since OS X 10.0. As far as I know, the only way to get Finder to accurately reflect the size of a folder after moving data out of it is to add another folder (or file) to it, even an empty folder will trigger the Finder to recalculate the folder's size.

  • How to list the rac databases on unix terminal

    Hi guys, I am trying to find out how to list all the rac databases on the unix terminal.
    the following command gives the list of all the databases running on a server
    *'ps -ef |grep smon | awk '{print $8}' | awk -F"_" '{print $3}''*
    of those databases i am trying to find the all the databases which are rac enabled.
    I tried srvctl status database -d 'database name'
    but with that i could find info on only one database at a time. So I am looking for a single command that lists out all the rac databases at a single go.
    can someone please help me figure out that command
    Thank You

    Try:
    srvctl config database

  • How do I get folder sizes?

    How can I get the finder to calculate folder sizes?
    I've clicked Calculate all sizes in view options.
    Even when I ask for info on a particular folder, I get a blank.
    It gives the sizes of files but never for folders: just two little dashes
    Is this a bug, or is there some extra button I now have to push?

    I believe there's a bug in the Finder that will prevent it from calculating folder sizes. I've only run into it a couple times: for example, Size in the Finder's Inspector window always shows -- (which is normal until the Finder calculates the size). In this case, the Finder doesn't calculate the size, but quitting and relaunching the Finder works to restore proper behavior.

  • How to find the size of a file or folder

    How can I find the size of a file or folder?
    I am trying to determine the size of my iPhoto and Mail folder.
    It says "Size: --" under general from Get Info.

    It's working fine...
    When you ask for that info, and Finder presents those '--' dashes instead of a value, actually, Finder is calculating the value in background.
    That's something that i recently noticed and wonder why tha heck he needs to do all that work by himself, kinda re-inventing the wheel of file size value "calculus"...
    I posted some thoughts about it here: File / Folder size... How do Finder gets it?
    Will appreciate feedback about this!
    Props!

Maybe you are looking for