[CentOS] ls --author ?

James B. Byrne ByrneJB at Harte-Lyne.ca
Mon Mar 20 16:35:58 UTC 2006

I want a script to determine the owner of a particular file and 
then "sudo -u <thatuserid> <somecomand>". I ran across the --author 
option of ls but that does not seem to give me anything useful.  It 
prints a short form of the filename without any other information 
at all.  In fact, the output of ls --author is indistinguishable 
from that of ls by itself:

> # ls --author htdocs/*
> htdocs/hlllogo.png
> # ls htdocs/*
> htdocs/hlllogo.png
> #

Is there a linux command that will return just the userid in a form 
that can be passed to sudo or do I have to parse ls -l <filename>?

I am digest subscriber so, if you could provide one, the favour of 
a direct copy of your reply is requested.


     *** e-mail is not a secure channel ***
James B. Byrne                Harte & Lyne Limited
vox: +1 905 561 1241          9 Brockley Drive
fax: +1 905 561 0757          Hamilton, Ontario
<token> = hal                 Canada L8E 3C3

More information about the CentOS mailing list