Results 1 to 5 of 5

Thread: list directory size in terminal for mounted cifs

  1. #1
    Join Date
    Jan 2013
    Beans
    48

    list directory size in terminal for mounted cifs

    I mounted an apple time capsule in /etc/fstab as cifs type to /media/time_capsule. I now want to look at directory file sizes to help me clean out the drive.

    I usually use the command below to list human readable sizes for files and directories:

    Code:
    ls -lh
    but all the directories show up with 0 size! Not sure why / how to let me view directory size in terminal with ls. Update an index?

    thanks.

  2. #2
    Join Date
    Jan 2013
    Location
    Vienna, Austria
    Beans
    56
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: list directory size in terminal for mounted cifs

    Try some of these commands while in /media/time_capsule:

    df -h

    or

    du -hs *

  3. #3
    Join Date
    Mar 2008
    Beans
    1,219

    Re: list directory size in terminal for mounted cifs

    Find files and sort by file size:
    Code:
    find /media/time_capsule -depth -type f -exec stat -c "%s %n" {} \;|sort -rn|more
    Find directories and sort by disk usage:
    Code:
    du /media/time_capsule|sort -rn|more
    Last edited by prodigy_; February 24th, 2013 at 05:27 PM.

  4. #4
    Join Date
    Jan 2013
    Beans
    48

    Re: list directory size in terminal for mounted cifs

    du and find with sort works great, thanks.
    I still don't understand why ls -l does this fir local directories and not for my mount.

  5. #5
    Join Date
    Jan 2013
    Location
    Vienna, Austria
    Beans
    56
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: list directory size in terminal for mounted cifs

    This depends on the cifs implementation on the server. Some older versions of smbd produce this kind of behaviour when running ls or certain other tools.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •