linux查看磁盘空闲空间,linux df 监控磁盘空闲空间

df 监控磁盘空闲空间

环境:

[oracle@simpleit shell]$ uname -a

Linux simpleit.domain.cn 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 athlon i386 GNU/Linux

[oracle@simpleit shell]$ cat /etc/redhat-release

CentOS release 5.5 (Final)

[oracle@simpleit shell]$ df -k

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 5952284 4627568 1017476 82% /

/dev/sda1 101086 29931 65936 32% /boot

tmpfs 505360 0 505360 0% /dev/shm

[oracle@simpleit shell]$ df -kl

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 5952284 4627568 1017476 82% /

/dev/sda1 101086 29931 65936 32% /boot

tmpfs 505360 0 505360 0% /dev/shm

df displays the amount of disk space

available on the file system containing each file name argument. If no file name is given,

the space available on all currently mounted file systems is shown. Disk space is shown in

1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case

512-byte blocks are used.

-k like --block-size=1K

-l, --local

limit listing to local file systems

一个小脚本:

####################################################################

## disk_free_space.sh ##

## created by Laughing ##

## 2012-01-06 ##

####################################################################

#!/bin/bash

df -kl | grep -iv Filesystem | awk '{ print $6", "$5}' |

while

read LINE;

do

ITEM=`echo $LINE | awk -F ',' '{ print $2 }' | awk -F '%' '{ print $1 }'`

if [ $ITEM -ge 90 ]

then

echo "`date` - ${LINE} space used on `hostname` "

fi

done

[oracle@simpleit shell]$ ./disk_free_space.sh

Sun Dec 18 16:10:25 CST 2011 - /, 82% space used on simpleit.domain.cn

Sun Dec 18 16:10:25 CST 2011 - /boot, 32% space used on simpleit.domain.cn

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值