Anu_1
1
I need to find available disk space for /home.
$ 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
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?
pludi
3
Force man df (Linux) to use POSIX mode, which is single-lined:
$ 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% /
1 Like
Randeep
5
You can aslo ust -hT option. It will show in human readable format and the fs type too.
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 [~]#
Gangam
6
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