Bash checkfreespace » Historie » Version 1
Jeremias Keihsler, 11.08.2017 06:40
| 1 | 1 | Jeremias Keihsler | h1. check free space |
|---|---|---|---|
| 2 | |||
| 3 | this is useful if you want to double check before a lengthy procress that there will be enough space on the drive |
||
| 4 | |||
| 5 | <pre> |
||
| 6 | FREE=`df -k --output=avail "$PWD" | tail -n1` # df -k not df -h |
||
| 7 | if [[ $FREE -lt 10485760 ]]; then # 10G = 10*1024*1024k |
||
| 8 | # less than 10GBs free! |
||
| 9 | fi; |
||
| 10 | </pre> |