Help to Find out Available disk space

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Help to Find out Available disk space
# 1  
Old 09-07-2011
Help to Find out Available disk space

I need to find available disk space for /home.
Code:
$ df /home 
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mahhh/VolGroup11-LogVol00
                            32281452   45028  26034172  15% /

$df  /home  |tail -1| awk '{print $4}'
15%

The above result shows the Use% instead of Available as the df command output expands in 2 lines due to the Filesystem name

For single line output the results are fine... Any ideas how to get the available space in such cases ...

Thanks a lot for help

Last edited by pludi; 09-07-2011 at 10:48 AM..
# 2  
Old 09-07-2011
I'm pretty sure that the line doesn't get broken when piped.

The percentage displayed is the used percentage, not the Available percentage, perhaps you could subtract used from 100?
# 3  
Old 09-07-2011
Force df to use POSIX mode, which is single-lined:
Code:
$ df /
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/system-root
                       2064208    490604   1468748  26% /
$ df -P /
Filesystem         1024-blocks      Used Available Capacity Mounted on
/dev/mapper/system-root   2064208    490604   1468748      26% /

This User Gave Thanks to pludi For This Post:
# 4  
Old 09-08-2011
Quote:
Originally Posted by pludi
Force df to use POSIX mode, which is single-lined:
Code:
$ df /
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/system-root
                       2064208    490604   1468748  26% /
$ df -P /
Filesystem         1024-blocks      Used Available Capacity Mounted on
/dev/mapper/system-root   2064208    490604   1468748      26% /

Thanks a lot Smilie..!!!
# 5  
Old 09-13-2011
You can aslo ust -hT option. It will show in human readable format and the fs type too.

Code:
root@cpaneltest [~]# df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
              ext3    7.7G  6.4G 1011M  87% /
/dev/sda1     ext3     99M   25M   70M  26% /boot
/usr/tmpDSK   ext3    485M   14M  447M   3% /tmp
root@cpaneltest [~]#


Last edited by pludi; 09-13-2011 at 03:42 PM..
# 6  
Old 01-04-2012
Hi ,

The above command is very helpful
In linux we use : df -P
Similarly for HP-UX using bdf ,how do we get in to POSIX mode.

Thanks in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need simpler way to find all my disk space utilization using df -h

Hi All, I am using SSH Tectia terminal to get the disk space utilization of a particular folder /opt/logs in all the servers one by one using the command df -h and looking through the list of folders manually to get /opt/logs folder disk space used percentage . The problem here is , it... (2 Replies)
Discussion started by: aakhan2011
2 Replies

2. Solaris

Unable to find utilized disk space on zone server.

Hi, I am unable to find remaining space on solaris 10. below is output. I am facing this issue on zone server. bash-3.00# df -h / Filesystem size used avail capacity Mounted on / 59G 59G 0K 100% / bash-3.00# pwd / bash-3.00# du -sh * 1K File_Stores 19K TT_DB 9K app 1K bin... (4 Replies)
Discussion started by: manoj.solaris
4 Replies

3. Shell Programming and Scripting

Find folders with timestamp and disk space used

Hi, I want write a script that finds a set of folders written between a certain time and then find the disk space used by those folders. Can someone please help. Thanks, Sparcman:( (1 Reply)
Discussion started by: sparcman
1 Replies

4. Shell Programming and Scripting

Perl Script to find the disk usage and to delete the files which is consuming more space

Hi All, I have written a script to check the file system usage and to delete the files which is consuming more space.Please check whether the script is corrcet #Script Starts here #!/usr/local/bin/perl #Program to find the disk space and to delete the older files #Checks the type of OS... (8 Replies)
Discussion started by: arunkarthick
8 Replies

5. Solaris

Disk Space

I know there are other threads but they have not helped. My server is running low on disk space and I haven't been able to re-allocate. I think my solaris machine is missing tools or the way it was originally setup, may not have the right pathing. $ df -k Filesystem kbytes used... (5 Replies)
Discussion started by: lnxjenn
5 Replies

6. UNIX for Dummies Questions & Answers

How to find the disk space allocated.

Hello, I need to find the total allocated disk space for the home directory. How can i find that in unix?(in GB). Thanks. (4 Replies)
Discussion started by: kailash19
4 Replies

7. Shell Programming and Scripting

Disk Space

Hi This is my script for disk space monitoring clear if then echo "You must be root user to execute the script" fi ALERT_LEVEL=10 CONSUMPTION_LEVEL= `df -k | awk {'print $5'} | cut -d '%' -f1 | sed "1 d"` for i in $CONSUMPTION_LEVEL do FILE_SYSTEM=`df -k | awk {'print $1'} |... (3 Replies)
Discussion started by: chrs0302
3 Replies

8. 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

9. Solaris

command to find free disk space on solaris

In linux df is the command to find free space what is the equivalent command in the Solaris (2 Replies)
Discussion started by: harishankar
2 Replies

10. UNIX for Dummies Questions & Answers

available disk space on disk device???

Hello, Can someone please tell me which command to use to determine the available disk space on a given disk device? I have to write a shell script that compresses files and stores them in a specific location but I am not sure how "conservative" I should be? Thanks in advance! Al. (4 Replies)
Discussion started by: alan
4 Replies
Login or Register to Ask a Question