Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (d+)%s*/$
- # df
- Filesystem 1K-blocks Used Available Use% Mounted on
- /dev/xvda 15997904 2404540 12943248 16% /
- tmpfs 252456 0 252456 0% /lib/init/rw
- tmpfs 252456 36 252420 1% /dev/shm
- df | awk 'NR > 1 {print $5, $6;}'
- 65% /
- 1% /dev
- 1% /dev/shm
- df | awk 'NR > 1 {print $5;}' | tr -d '%'
- df | awk '//dev/shm$/ {print $5;}' | tr -d '%'
- df | awk '//$/ {print $5;}' | tr -d '%'
- df -h | egrep --only-matching '[[:digit:]]+%' | tr -d '%'
- import subprocess
- import re
- print re.search('(d+)% /', subprocess.Popen(["df"], stdout=subprocess.PIPE).communicate()[0]).group(1)
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import subprocess
- import re
- p = subprocess.Popen(["df"], stdout=subprocess.PIPE)
- for line in p.stdout:
- usage = re.search('(d+)% /', line.rstrip())
- if usage != None:
- print usage.group(1)
- df --output=pcent,target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement