Skip to content

Instantly share code, notes, and snippets.

@RLovelett
Created July 2, 2014 20:07
Show Gist options
  • Save RLovelett/7060cec3d3fd14018326 to your computer and use it in GitHub Desktop.
Save RLovelett/7060cec3d3fd14018326 to your computer and use it in GitHub Desktop.
Delete ZFS snapshots from dataset one-liner
zfs list -r -H -t snapshot -o name stream/lxc/stash | xargs -n1 zfs destroy
@grizzlyfred
Copy link

I like that one (to be selective, I have 3 pools on my pc):
zfs list -r -H -t snapshot -o name | grep <poolname/whatever> | xargs -n1 zfs destroy

@kenthinson
Copy link

zfs destroy -rvn dataset_or_zvol_name@%
remove -n to actually run.

@evie404
Copy link

evie404 commented May 8, 2021

just be careful that this doesn't handle well with datasets that has space in their names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment