Shell command to retrieve file ownership of a determed file

Michael Velez mikev777 at hotmail.com
Thu Sep 7 09:26:37 UTC 2006


 

> -----Original Message-----
> From: redhat-list-bounces at redhat.com 
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of Martin Thoma
> Sent: Thursday, September 07, 2006 3:36 AM
> To: General Red Hat Linux discussion list
> Subject: Shell command to retrieve file ownership of a determed file
> 
> Hi
> 
> I am writing a shell script that is verifies ownership and 
> the file access permissions of selected files. Is there a 
> tool that allows me to retrieve the uid,gid and mode directly 
> instead of 'ls -l | grep <filename> | cut -d" " ...'?
> 
> Thanks for a hint.
> 
> Cheers Martin

The best thing I know of is not too much different from what you have:

ls -l <filename> | awk '{print $1}'
ls -l <filename> | awk '{print $3}'
ls -l <filename> | awk '{print $4}'

or ls -l <filename> | awk '{print $1" "$3" "$4}'

Michael




More information about the redhat-list mailing list