0
$ df -H
Filesystem             Size   Used  Avail Use% Mounted on
/dev/mapper/vg_app001-lv_root
                        34G    12G    21G  35% /
tmpfs                  8.4G      0   8.4G   0% /dev/shm
/dev/sda1              508M    54M   429M  12% /boot
/dev/mapper/vg_app001-lv_home
                        19G   309M    17G   2% /home

I want to run a disk monitor script but because the filesystem is so long the row has been split into two lines and the script fails.

Any suggestions?

DD.
  • 3,114
  • 11
  • 35
  • 50

2 Answers2

1

Try df -P It will use posix format

quanta
  • 51,413
  • 19
  • 159
  • 217
  • what exactly is posix format? – DD. Jun 08 '12 at 10:30
  • http://en.wikipedia.org/wiki/POSIX - basically, it's a defined standard to which all Unix-like POSIX compliant operating systems 'try' to adhere. It defines the format of a lot of stuff. – EightBitTony Jun 08 '12 at 11:52
  • Do people still recommend setting LANG=C in scripts before interpreting the output from commands, in case LANG=somethingweird causes your script to fail? – EightBitTony Jun 08 '12 at 11:54
1

I am using this line:

df -PTlk -x smbfs -x tmpfs -x cifs -x iso9660 -x udf -x nfsv4 | sed 1d

(stolen from Check-MK Agent)

krissi
  • 3,387
  • 1
  • 19
  • 22