Create a new article
Write your page title here:
We currently have 3,185 articles on s23. Type your article name above or click on one of the titles below and start writing!


ZFS List Command alias

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[edit]

First version with some custom chosen fields

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

Custom Fields Sorted[edit]

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[edit]

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)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.