Operating System - HP-UX
1850374 Members
2822 Online
104054 Solutions
New Discussion

Re: used space .. ls command? This one ..

 
SOLVED
Go to solution
someone_4
Honored Contributor

used space .. ls command? This one ..

Would anyone happened to know the ls command that will list all the files in a directory and sub dir
from biggest to smallest
thanks
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: used space .. ls command? This one ..

Richard:

The command you want is 'du'. Pipe the output to sort. See the man pages for a full description.

...JRF...
someone_4
Honored Contributor

Re: used space .. ls command? This one ..

I tried that .. that is a great command I didnt know about..
I used ls -lR and that works too
I am going to try to resort that data too.
Anyone else have any sugestions?
Andrew_4
Honored Contributor
Solution

Re: used space .. ls command? This one ..

Try this the a command (it will find all the files under whatever directory, you specify, and sort them by size) :

find / . -xdev -type f | xargs du | sort -rn | more


Andrew
The Unix Programmer's Manual, 2nd Edition, June, 1972: "The number of Unix installations has grown to 10, with more expected."
Andrew_4
Honored Contributor

Re: used space .. ls command? This one ..

Also,

The above command is useful when files systems fill up... It can tell you what your biggest files are, so that you can consider removing them !!

Great for those /var filessystem fulls !!

Andrew
The Unix Programmer's Manual, 2nd Edition, June, 1972: "The number of Unix installations has grown to 10, with more expected."
federico_3
Honored Contributor

Re: used space .. ls command? This one ..

Try :

quot : it displays the number of 1024-byte blocks in the named FS that are currently owned by each user

diskusg: it generates disk accounting information from data in files

du : it gives the space allocated for all files and directories . ( "du -sk filesystem " will give you the total used space in KBs for filesystem)


bdf : it displays the total space, the free one and the percentage for each FS .


federico
Carlos Fernandez Riera
Honored Contributor

Re: used space .. ls command? This one ..


ll -R | sort -n +4.0
unsupported