du flag -x

Hi,

I would like to know if there's any option to use with the du command so that I can list only the files/directories on the current filesystem... I usually use

du -gs *

But I'd like to see only the directories in the filesystem I am on, and not the mount point directory of other fss...

I know -x flag has something to do with that, but man pages doesn't show any example.

Thanks in advance!!

p.s.: sorry for my English :smiley:

yeah.You are right. You can use -x flag to display the size of files present in particular FS.

du -xm /mountpoint

will show you the sizes of files present in /mountpoint.....

HTH

Hi faruk, thanks for your answer.

That worked fine, but I was actually asking about doing something like listing only directories

i.e.: I use on /

du -ms * | sort

and that shows me a list of all directories (-s) in the / filesystem. The matter is that I may have many filesystems mounted over /, which are shown as a normal directory. Now, I don't want to list all those mount points over / (like /usr, /var, and any other fs), only normal directories created on /.

Is it possible to do that?

I apologize for my English, I hope you have understood.

Thanks again!

du -xsm /

lists the total used size for /, no /opt, no /usr, no /var...

I think that is what you want

if you want /, /usr,/var,/opt.. use

>du -xsm / /var /opt /usr | sort -n
20.75   /var
31.70   /
433.06  /opt
1807.20 /usr

Hi funksen,

Mmmh no that is not what I am actually looking for. I don't want to see the total size of the /

I'll try to give a more clear example of what I wanna do:

ls /

.
/
/dir1
/dir2
/dir3
/dirN
/opt
/usr
/var
/zzzdir1
...

and I want to see the total size of those directories on / which are not filesystems (that is, /dir1, /dir2, /dir3, etc, and not /usr, /var, etc.).

The output would be, for example

3.4 /dir1
6.2 /dir2
1.7 /dir3
9.0 /dirN
0.6 /zzzdir1

as in a normal

du -gs *

output, but not listing the sizes of /var, /opt, and the rest of the filesystems on /.

I hope I was clear this time, I don't know if what I want to do is even possible.

Thanks again for your answer

Regards

That means you have to use differend command.

#df -g

it will display actually what you are expecting..............

since AIX find does not have the -maxdepth option, you need a combination of commands

here for example:

ls -ld * | awk '/^d/{print $NF}' | while read i ; do df | grep -qsw $(pwd)$i || du -xsm $i ; done

put it in a executable script in a directory listen in the $PATH variable

perhaps you want to use $1 to give an argument