ZFS List Command alias

From S23Wiki
Revision as of 14:44, 21 April 2013 by DrOwl (Talk | contribs) (first meanderings)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I am trying to create a nice Alias for the `zfs list` command.

This is all happening on a "SunOS 5.11 11.1 i86pc i386 i86pc Solaris" not convinced it will be portable not to start with any way!

These are various workings and versions.

Custom Fields

First version with some custom chosen fields

alias zlist='zfs list -o name,used,refer,usedbydataset,usedbysnapshots,avail,compressratio,mountpoint'

Custom Fields Sorted

The same as above but sorted by space used

alias zlists='zfs list -o name,used,refer,usedbydataset,usedbysnapshots,avail,compressratio,mountpoint | /usr/gnu/bin/sort -rhk2'

Custom Fields Sorted and Filtered

I have several old BE's (Boot Environments) I don't want to delete them but I also don't want them shown every time I do a list

 alias zlist="zfs list -o name,used,refer,usedbydataset,usedbysnapshots,avail,compressratio,mountpoint |/usr/gnu/bin/egrep -v \
 \"$(beadm list -H  | awk -F$';' ' out != "" && $3 != "N" && $3 != "R" { out=out "[[:space:]]|" $1 } ; out == "" && $3 != "N" && $3 != "R" { out=$1 } ; END { print out } ')\" "

This is not how I want it yet! far from it!

  1. the sub command for beadmin list is run when the alias is created
  2. I would like the BE's that are displayed to have there status listed next to them (N = Active now, R = Active on reboot)
    1. This is probably best all done in awk instead of using grep (OK its probably best in some "real" programming language like perl but I wanted to do it in shell so narrrrr)