Find Files by Group Ownership


file -group

If an option that allows you to work with users is available for a command, you know that an option for groups is also probably present. The find command is no different: If you want to look for files owned by a particular group, just use -group, followed by the group's name or number. On the music drive, scott should be the owner and music should be the group. Let's see if there are any files that aren't in the music group:

$ find . ! -group music ./Disco/Brides_of_Funkenstein_-_Disco_to_Go.mp3 ./Disco/Sister_Sledge_-_He's_The_Greatest_Dancer.mp3 ./Disco/Wild_Cherry_-_Play_That_Funky_Music.mp3 ./Electronica/New_Order/Bizarre_Love_Triangle.mp3 


There are only four files out of a large number of files that aren't in the music group. Now we need to run chgrp (see Chapter 7) on these files to make everything on the drive exactly the same.

Notice that, once again, we used ! to say, "Find the files that are not owned by the music group."



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net