[CentOS] ls --author ?

Cameron Showalter cameron at gwschool.com
Mon Mar 20 16:41:54 UTC 2006


James B. Byrne wrote:
> 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.
> 
> Regards,
> Jim
> 
> --   
>      *** e-mail is not a secure channel ***
> mailto:byrnejb.<token>@harte-lyne.ca
> 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
> 
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
> 
> 

ls -l <filename> | awk '{print $3}' will give you the owner of the file.




More information about the CentOS mailing list