Need to find the percentage of the directory in the file system.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to find the percentage of the directory in the file system.
# 1  
Old 02-12-2009
Java Need to find the percentage of the directory in the file system.

Hi All,

I want to find the percentage occupied by the directory in the file system.
Say, i have the file system
/home/arun/work
under this file system i have the directories
/home/arun/work/yesterday
/home/arun/work/today
/home/arun/work/tomorrow

The size of the file system is
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 983040 274052 73% 12126 3% /home/arun/work
In this i want to find how much spaces oocupied by the directories
yesterday, today and tomorrow under this file system.

Please guide me.
# 2  
Old 02-12-2009
Try out the command "du".
Code:
man du

When you get values, you can use arithmetics to add, subtract etc.
# 3  
Old 02-12-2009
Java Thnx zaxxon,

du /home/arun/work/yesterday
du /home/arun/work/today
du /home/arun/work/tomorrow

all is giving the block size like
/home/arun/work/yesterday - 230
/home/arun/work/today - 598
/home/arun/work/tomorrow - 8754

and my file system /home/arun/work contains 123456 blocks.
In this i want to find what percentage of blocks was utilized by each of its directories like "yesterday", "today" and "tomorrow".

We have to calculate the size of the blocks which was consumed by all it sub-directories and files under the directories "yesterday", "today" and "tomorrow".

Please give me some suggestions to find this.
# 4  
Old 02-12-2009
Quote:
Originally Posted by Arunprasad
We have to calculate ....
We ? Who ? Please read the forum rules , no homework's.
... and show some effort to solve your problem !
# 5  
Old 02-12-2009
sol

user
du -h /abc/def/ghi

#which will give the actual size of the folder in kb or mb or gb
# 6  
Old 02-12-2009
#!/bin/sh

# This is a command that will generate a space report.

du -sh * | sort -nr > $HOME/space_report.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find and get a file in an entire directory with an excluded directory specified?

How to get a file 'zlib.h' in an entire directory with an excluded directory specified lives under that starting directory by using find command, as it failed on: $ find . -name 'zlib.h' -a -ipath 'CHROME.TMP' -prune -o -print it'll just list entirely up (2 Replies)
Discussion started by: abdulbadii
2 Replies

2. Shell Programming and Scripting

find percentage - awk

Please help me with this ... Input file /vol/test1 10G /vol/test2 1G /vol/test3 200G /vol/test4 3G Output File /vol/test1 10G - - 9G - /vol/test2 1024M - - 921M - /vol/test3 200G - - 180G - /vol/test4 3072M - - 2764M - Basically if Column 2 ( which is... (6 Replies)
Discussion started by: greycells
6 Replies

3. AIX

File system percentage to the hole size ?

Hi, I'd like to know how can I figure out my disk space area on AIX machine, for example to the situation of ( df -g ) which I have in my system : the area used by (/opt/oracle) file system is (98%) now. the free area on (/opt/oracle) is (0.75) now. the total size in Gigabyte... (1 Reply)
Discussion started by: arm
1 Replies

4. Programming

Shell script to find Percentage?

Hi all, I havea log of data.log bear,10000,white bear,5000,black chicken,2000,white chicken,4000,yellow chicken,3000,black lion,6000,yellow lion,1000,white How can we have shell script to get the percentage of each animals? Thanks. (8 Replies)
Discussion started by: sabercats
8 Replies

5. HP-UX

Potential file system contention on directory

We have an 8-processor Itanium system running HP-UX 11.23 connected to shared SAN discs. We have an application that creates files (about 10) in a specific directory. When the application terminates, these files are removed (unlink) and a few others are updated. The directory contains... (8 Replies)
Discussion started by: FDesrochers
8 Replies

6. Shell Programming and Scripting

script to differenciate directory and file system

I need to write a script which will check all the directories in / and find out which is separate filesystem or a directory inside / suppose i have /application -->/dev/hdisk0 is a partitiom /abc --> is a directory /xyz-->is a directory /db-->/dev/hdisk1 is a partition actually my / gets... (2 Replies)
Discussion started by: pchangba
2 Replies

7. UNIX for Dummies Questions & Answers

How to find a file whick is consuming larger disk space in file system

Hello, Can anybody please tell me the command to find out the filesystem or a file which is consuming larger disk space sing i want to find out the file and want to compress it please help me out any help would be appreciated (6 Replies)
Discussion started by: lokeshpashine
6 Replies

8. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

9. UNIX for Dummies Questions & Answers

how many directory can be mounted on one file system

I have a question and seek help. How many directory can be mounted on one file system on UNIX with solaris 9? For example, I have one file system as /dev/dsk/cieit0a6. I have created one directory as /u01/app/oracle and mounted this directory to cieit06. It works. Then I create another directory as... (4 Replies)
Discussion started by: duke0001
4 Replies

10. UNIX for Dummies Questions & Answers

Distinction b/w file system and directory

Can you give a very basic definition of file system vs. directory in unix. The context is around monitoring for disk capacity maxing out. Why would /appl/sbe/inst_2/config/logs not be able to be because it is a directory but appl/cce can be monitored because it is a unix file system. They... (1 Reply)
Discussion started by: kd9626
1 Replies
Login or Register to Ask a Question