Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-08-2013
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 2
Thanked 0 Times in 0 Posts
Finding the group owner for a file

How would I find out who the group openers is of a file? For example:


Code:
> ls -l myfile
-rwxr-xr-x    1 myronp   hawks            20125 Oct 20 20:50 myfile

How do I return just hawks. I could do this with a series of cut or awk, but is there a more direct way.

The ls -g is better, but still has all the permissions, size info:


Code:
> ls -g sweepftp
-rwxr-xr-x    1 lawson        20125 Oct 20 20:50 sweepftp

There must be a better way to get the group of a file.

Last edited by Scrutinizer; 02-08-2013 at 01:08 PM.. Reason: code tags
Sponsored Links
    #2  
Old 02-08-2013
alister alister is offline Forum Advisor  
Registered User
 
Join Date: Dec 2009
Posts: 2,593
Thanks: 122
Thanked 716 Times in 599 Posts
If your system has a stat utility, man 1 stat should tell you all you need to know. Specifically, for customized output, with GNU stat see the -c option; with BSD stat, see the -f option.

Regards,
Alister
Sponsored Links
Reply

Tags
file, group, owner

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Finding the Group Owner Name mansahr143 UNIX for Dummies Questions & Answers 4 11-11-2012 05:50 PM
Creating a file where the owner and group is not root jdilts UNIX for Dummies Questions & Answers 20 06-09-2012 01:12 AM
How to set the name of the group and the owner while creation of the file? nehak UNIX for Dummies Questions & Answers 2 04-23-2008 08:26 AM
File Owner/Group through Shell Script rahulrathod Shell Programming and Scripting 1 02-26-2008 01:45 PM
Can't change owner and group of a linux file bache_gowda UNIX for Dummies Questions & Answers 7 06-26-2003 10:08 PM



All times are GMT -4. The time now is 02:13 PM.