Linux Phrasebook 

 Find Files by Ownership


Find Files by Ownership

find -user

In addition to searching for files by name, you can also search for files by owner. Do you want to find the files on the music drive owned by scott? Use find with the -user option, followed by the user name (or the user number, which you can find in /etc/passwd):

$ find . -user scott

Whoa! There are way too many results! It might be easier to look for files that are not owned by scott. To do so, put a ! in front of the option you wish to reverse:

Note

In order to conserve space, some of the data you'd normally see with ls -l has been removed.


$ find . ! -user scott
./Outsider/Wing/01_-_Dancing_Queen.mp3
$ ls -l ./Outsider/Wing/01_-_Dancing_Queen.mp3
gus music ./Outsider/Wing/01_-_Dancing_Queen.mp3

Ah... one song by Wing is owned by gus instead of scott. To fix this problem, we need to use chown (covered in Chapter 7, "Ownerships and Permissions"). Keep in mind that you can always use the ! as a NOT operator (which is saying, for example, "find files where the user is not scott").

Note

Ah, Wing. First introduced to the world at large in an episode of South Park, her website can be found at www.wingtunes.com. Wing's version of "Dancing Queen" is highly recommended, as is her rendition of "I Want to Hold Your Hand."



 

Authors: Granneman S.

ISBN: 0672328380   Current page: 177 from 288

This Guide are presented on flylib.com

Our library present to you materials from book Linux Phrasebook.

Warning! The page Find Files by Ownership from this book is informational only! Do not print out this page! Do NOT SUBMIT this page as part of your website or work without confirmation from the authors.

You can read the contents of the book, but we strongly recommend that you purchase. or example, you can Buy this book on Amazon.com


  • Authors:
  • Granneman S.
  • Keys:
  • files
  • -user
  • music
  • owned
  • scott
  • option
  • which
  • outsider
  • Buy this book on Amazon.com

if you may any questions - contact us: flylib(at)qtcs.net
Privacy Policy