% df -g | nawk '{if (NR % 5 == 1) printf "%-22s", $1 ; if (NR % 5 == 4) printf "%-10s", "fstype " $1 "\n"; if (NR % 5 == 2) printf "%-30s",$1/2/1024/1024 " GB"; if (NR % 5 == 2) printf "%-30s", $4/2/1024/1024 " GB free "}'
/ | 33.6627 GB | 18.4351 GB free | fstype ufs |
/devices | 0 GB | 0 GB free | fstype devfs |
/system/contract | 0 GB | 0 GB free | fstype ctfs |
/proc | 0 GB | 0 GB free | fstype proc |
/etc/mnttab | 0 GB | 0 GB free | fstype mntfs |
/etc/svc/volatile | 7.88214 GB | 7.8813 GB free | fstype tmpfs |
/system/object | 0 GB | 0 GB free | fstype objfs |
/lib/libc.so.1 | 33.6627 GB | 18.4351 GB free | fstype ufs |
/dev/fd | 0 GB | 0 GB free | fstype fd |
/tmp | 7.88142 GB | 7.8813 GB free | fstype tmpfs |
/var/run | 7.88134 GB | 7.8813 GB free | fstype tmpfs |
/export/home | 74.4858 GB | 1.87458 GB free | fstype ufs |
/storage | 108.639 GB | 66.9259 GB free | fstype nfs |
You can also add a comma (,) to the separators and output > csv (you can open the comma separated values table in Excel or OpenOffice or any other Spreadsheet application) :-).
Heh.
ReplyDeleteThat was one of my frustrations with Solaris - doesn't support simple usability options for common utilities. Ie, no -h for du and df, no --color for ls. Minor, sure. But handy.
On my Linux systems, I like -T for df, which shows the filesystem type. I'd paste output here, but blogger doesn't allow pre tags.
Solaris 10 supports du / df -h and so on, not an issue. You could use GNU ls (gls) for color support but you'd lose extemded ACL and other atributes.
ReplyDeleteSure, some UNIX systems don't support du -h, but I doubt that's an issue awk can't fix.
Want MB output in df on AIX for example:
# df -k | awk '{ printf "%-12s", $2/1024 " MB "; print $0 }';
39552 MB /dev/lv05 40501248 9267396 78% 452 1% /u04
You just muck about with AWK to manipulate the data output. A few well placed scripts and aliases in your .shellrc will solve the problems :-). Just keep a OS independent .zshrc in a Mercurial repo :P.
Hello
ReplyDeleteThanks, It makes me more easy
to do the volume management
I'm starting with IBM AIX
and some detaails are some difficulto to undestand.
Reggardts