ls --author ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, 20 Mar 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>?

stat -c %U filename

The stat(1) man page has format details; it's part of the coreutils 
rpm.

-- 
Paul Heinlein <> heinlein@xxxxxxxxxx <> www.madboa.com

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux