du flag -x


 
Thread Tools Search this Thread
Operating Systems AIX du flag -x
# 1  
Old 09-13-2009
Question 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

Code:
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 Smilie
# 2  
Old 09-13-2009
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
# 3  
Old 09-14-2009
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 /

Code:
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!
# 4  
Old 09-15-2009
Code:
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

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

# 5  
Old 09-15-2009
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:

Code:
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
Code:
3.4 /dir1
6.2 /dir2
1.7 /dir3
9.0 /dirN
0.6 /zzzdir1

as in a normal

Code:
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
# 6  
Old 09-16-2009
MySQL

Quote:
Originally Posted by Casey
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:

Code:
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
Code:
3.4 /dir1
6.2 /dir2
1.7 /dir3
9.0 /dirN
0.6 /zzzdir1

as in a normal

Code:
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..............
# 7  
Old 09-16-2009
since AIX find does not have the -maxdepth option, you need a combination of commands

here for example:

Code:
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

Last edited by funksen; 09-16-2009 at 06:46 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Get the id with specify flag

.... means multi line ddd,bug fgdrg dfdfsdfdfsd fsdfdfdfd fdfdsfdsfsd ....... flag2 ...... aaa,bug sfsfsfsfs dfdfsdfdfsd fsdfdfdfd fdfdsfdsfsd ...... flag1 ...... ddd,bug fgdrg dfdfsdfdfsd (9 Replies)
Discussion started by: yanglei_fage
9 Replies

2. UNIX for Dummies Questions & Answers

'h' flag in du

Hey, all! Why is the "human readable" flag changing the behavior of du? And while I'm at it, can you make du only look at files, not directories. I often find myself wanting to find the largest file(s) in a dir or vol. Using 'find' itself, it seems you have to at least be able to guess the size of... (2 Replies)
Discussion started by: sudon't
2 Replies

3. AIX

Flag issue

Hi all, We dont have access to aix source code and i have a doubt. The flag SC_NO_RESERVE, is it got to do anything with the failover? If the flag is set the paths are going to failed state. If flag is not set everything comes up fine after failover. Thanks in advance for helping ... (2 Replies)
Discussion started by: gnakul
2 Replies

4. Shell Programming and Scripting

Add the flag

#!/bin/bash while : do ./abc.sh PB sleep 60 ./abc.sh RA sleep 60 ./abc.sh GS sleep 68400 done Instead of making the script sleep for sometime, it doesn't work all the time as time may shift over a period. How to make a script wake up every 30 seconds and check the current time, if... (2 Replies)
Discussion started by: sandy1028
2 Replies

5. Shell Programming and Scripting

Date Time of FLAG

Hi, I am first sorry to ask for that, but I am in trouble so I hope you will be agreed to help me on this. I am solaris (ksh). I have a lots of file but I only need to get the date and time of the flag files. Here is the "ls -lrt" view : ls -lrt | grep Flag_Saturne_R*Return ... (3 Replies)
Discussion started by: Aswex
3 Replies

6. Red Hat

-ansi flag support for g++

I have been compiling a cpp program using following command: g++ -c -ansi a.cpp with g++ version 4.1.2. I want to know the significance of the -ansi flag and which other higher g++ version supports this flag by default Dhiraj (1 Reply)
Discussion started by: dhiraj kurhade
1 Replies

7. Shell Programming and Scripting

checking for a flag in a subscript?

I want to incorportae a subscript in a job script which is used for loading purposes. What i require is that before a job runs it should check for a flag ,if flag is not present then create it and the loading should start. Once loading finishes it should delete the flag. So if any other load... (2 Replies)
Discussion started by: bathla
2 Replies

8. AIX

Checking for flag in a subscript?

I want to incorportae a subscript in a job script which is used for loading purposes. What i require is that before a job runs it should check for a flag ,if flag is not present then create it and the loading should start. Once loading finishes it should delete the flag. So if any other load... (1 Reply)
Discussion started by: bathla
1 Replies

9. Shell Programming and Scripting

find and size flag

Hello everyone, I would like to filter and search for files in my curr dir where the blocks used by those files are over a certain number (i.e. 30), when I try this command find . -name "c*" -size +30 -exec ls -ls {} \; I get a list of files, the first column is the block size, right? ... (1 Reply)
Discussion started by: gio001
1 Replies

10. Shell Programming and Scripting

the flag -c in sh command

I need your help please. In a production system, i've seen many running process as follow: sh -c ./pathname/shellname what exactly the flag option -c is used for? ive tried to look at the man page, but it doesnt say much. ill appreciate yor help. Thanks (4 Replies)
Discussion started by: alexcol
4 Replies
Login or Register to Ask a Question