Results 1 to 5 of 5

Thread: du command?

  1. #1

    Question du command?

    I learned a little bit about this command (du) to find out how much space a directory takes up but what I want to know is can you tell it to exclude directories?
    For instance, I wanted to know how large the / directory is on my old suse10 drive but I want to exclude /home (/home was not a separate partition on that drive).

  2. #2
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,760

    Default Re: du command?

    Type

    info du

    to get all the option I think what you may want is the -x option

  3. #3

    Default Re: du command?

    du -sh --one-file-system / is what you'd want to run to get that.

    -s gives only a summary, rather than showing the size of every file and folder contained in the path you give (in this case, /)
    -h outputs in human readable terms (M,G)
    --one-file-system does exactly that.

    If you wanted to know how large every folder on / is (like /tmp, /var, /usr) you'd run this: du -sh --one-file-system /*

  4. #4

    Default Re: du command?

    Quote Originally Posted by gymnart View Post
    I learned a little bit about this command (du) to find out how much space a directory takes up but what I want to know is can you tell it to exclude directories?
    For instance, I wanted to know how large the / directory is on my old suse10 drive but I want to exclude /home (/home was not a separate partition on that drive).
    I find info hard to navigate, so,
    Code:
    du --help
    man du
    Box 1: OpenSuse 11.1/Win7 | Linux 2.6.27 Gnome | AMD 64 X2 6000+ | nVidia 8600GT | 2GB RAM
    Box 2: OpenSuse 11.2 | Linux 2.6.31 Gnome | AMD 64 3000+ | ATI X800 Pro | 1GB RAM
    Box 3: Win7 Premium Home | Intel P4 3.0Gz | ATI AIW 2006 | 2GB RAM

  5. #5
    Join Date
    Sep 2009
    Location
    Seattle, WA
    Posts
    276

    Default Re: du command?

    Quote Originally Posted by russlar View Post
    du -sh --one-file-system / is what you'd want to run to get that.

    -s gives only a summary, rather than showing the size of every file and folder contained in the path you give (in this case, /)
    -h outputs in human readable terms (M,G)
    --one-file-system does exactly that.

    If you wanted to know how large every folder on / is (like /tmp, /var, /usr) you'd run this: du -sh --one-file-system /*
    That would still include /home unless it was on a separate partition. The exclude (-x) is what's wanted.

    Tom
    Tom Taylor - retired penguin
    AMD Phenom II x4 955 -- 4GB RAM -- 2x1.5TB sata3
    openSUSE 12.3x86_64 openSUSE 13.1-M2x86_64
    KDE 4.8.5, FF 14.0.1 - 8- KDE 4.10.0, FF 20.0
    registered linux user 263467

Tags for this Thread

Posting Permissions

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