Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
Hi, I have a folder named "test" with many subfolders and files and with in it. What is the command to determine the total size of the folder name "test",including ...
  1. #1
    Just Joined!
    Join Date
    Jun 2005
    Posts
    8

    Determine the folder size

    Hi,

    I have a folder named "test" with many subfolders and files and with in it.

    What is the command to determine the total size of the folder name "test",including the subfolders and files,in bytes ?

    Could any one help me on this ?

    Thanks,
    Nithya

  2. #2
    Linux User nalg0rath's Avatar
    Join Date
    Sep 2004
    Location
    Stockholm
    Posts
    303
    Try:
    Code:
    du -s /dir/

  3. #3
    Linux Newbie
    Join Date
    Jul 2005
    Location
    Chd,India
    Posts
    135
    try stat filename for complete info on file
    along with size
    The strong shall live and the weak will die
    In the end,only the fittest survive in this world
    - Shishio Makoto

  4. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    du shows the size in blocks, which is a more accurate representation of the space occupied by files. wc -c will give the size of individual files in bytes. BTW, they're called directories in UNIX/Linux. not folders; that's a Windoze abomination.

  5. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Quote Originally Posted by scm
    BTW, they're called directories in UNIX/Linux. not folders; that's a Windoze abomination.
    And that is Unix (not UNIX) and GNU/Linux to you, Sir!
    Anyway, I can't deny that I agree with you. Make of it what you will, but here's a discussion on this from two and a half years back: http://www.linuxforums.org/forum/topic-217.html

    To add something on-topic to this discussion, I might as well say that, to replicate what `du' does when it counts actual blocks, see the st_blocks and st_blksize elements of the return struct used when calling stat(2) on a file. st_blocks returns the number of blocks a file takes up, and st_blksize returns the blocksize of the filesystem that the file resides on. In other words, to get the effective space a file occupies, multiply st_blocks and st_blksize with each other.
    I have no idea what ReiserFS returns here when tail packing.

  6. #6
    Linux User
    Join Date
    Oct 2004
    Location
    /dev/random
    Posts
    404
    Code:
    $du -ah /path/to/dir
    http://www.die.net/doc/linux/man/man1/du.1.html

    -a : all files
    -h : human-readable form
    The Unforgiven
    Registered Linux User #358564

  7. #7
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Quote Originally Posted by Dolda2000
    Quote Originally Posted by scm
    BTW, they're called directories in UNIX/Linux. not folders; that's a Windoze abomination.
    And that is Unix (not UNIX) and GNU/Linux to you, Sir!
    Anyway, I can't deny that I agree with you. Make of it what you will, but here's a discussion on this from two and a half years back: http://www.linuxforums.org/forum/topic-217.html

    To add something on-topic to this discussion, I might as well say that, to replicate what `du' does when it counts actual blocks, see the st_blocks and st_blksize elements of the return struct used when calling stat(2) on a file. st_blocks returns the number of blocks a file takes up, and st_blksize returns the blocksize of the filesystem that the file resides on. In other words, to get the effective space a file occupies, multiply st_blocks and st_blksize with each other.
    I have no idea what ReiserFS returns here when tail packing.
    Ask Dolda2000 a question, he'll tell you the system call.

  8. #8
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    du -b will give you the size in bytes.But it seems
    to be Linux specific.
    I have no idea what ReiserFS returns here when tail packing.
    I have no idea what this means

    By the way I read the other thread.Who was that wassy121 who was
    threatening to lock it ? Was he a mod back then ?

  9. #9
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    I think he used to be one.

  10. #10
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    Why isn't he anymore ? Was he demoted or something ?

Page 1 of 3 1 2 3 LastLast

Posting Permissions

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