Re: Shell command to retrieve file ownership of a determed file

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

 



Michael Velez wrote:
-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-bounces@xxxxxxxxxx] 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

Thanks for your hint Michael. I am using now something like:

ls -l | awk '$9  ~ /<filename>/ {print $3, $4}'


Cheers

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux