I have found some information related to the use of the -exec command associated with "find".
The syntax of the command would be like the following:
What this does is simply finding any files named "readme.txt" under "~/" folder. Every instanced found will be displayed using the "cat" command.
I figured, I could use the similar syntax for a different purpose.
What I am trying to do is to list all the snapshots on my Freenas machine that would have a specific flag set.
This is useful when it comes to deleting snapshots that have been placed under "hold", which would prevent deletion of the snapshot.
The commands I have been using are as follow:
The last one is causing Putty to crash.
I can't seem to understand the logic behind the use of the -exec command.
Does it only work with the "find" command?
The idea is to list all the snapshots on the pool or simply target a single dataset and return the holds status.
The syntax of the command would be like the following:
Code:
find ~/ -iname readme.txt -exec cat '{}' \;
What this does is simply finding any files named "readme.txt" under "~/" folder. Every instanced found will be displayed using the "cat" command.
I figured, I could use the similar syntax for a different purpose.
What I am trying to do is to list all the snapshots on my Freenas machine that would have a specific flag set.
This is useful when it comes to deleting snapshots that have been placed under "hold", which would prevent deletion of the snapshot.
The commands I have been using are as follow:
Code:
zfs list -t snapshot -o name | grep -i dataset -exec zfs holds '{}' \; zfs list -t snapshot -o name | grep -i dataset exec zfs holds '{}' \; zfs list -t snapshot -o name -exec zfs holds '{}' \; zfs list -t snapshot -o name exec zfs holds '{}' \; zfs list -t snapshot -o name |exec zfs holds '{}' \;
The last one is causing Putty to crash.
I can't seem to understand the logic behind the use of the -exec command.
Does it only work with the "find" command?
The idea is to list all the snapshots on the pool or simply target a single dataset and return the holds status.