This will do what you want. vmquery -bx -rn 0 | tail +4 | wc -l where the argument to -rn is the robot number to count the media in (in my case, 0).