Unix/Linux Go Back    


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 !!

Awk/script to list the owners of files

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-30-2013
ggayathri ggayathri is offline
Registered User
 
Join Date: Oct 2008
Last Activity: 10 May 2016, 10:46 AM EDT
Posts: 77
Thanks: 1
Thanked 0 Times in 0 Posts
Awk/script to list the owners of files

I have to list the files in a directory and along with that, list the owner of each of those files. Can someone please help me with a way to get this info please?

Gayathri
Sponsored Links
    #2  
Old Unix and Linux 10-30-2013
sea sea is offline
Registered User
 
Join Date: Sep 2013
Last Activity: 25 May 2016, 9:23 AM EDT
Location: Swissh
Posts: 1,285
Thanks: 256
Thanked 225 Times in 208 Posts
Have a try with:

Code:
ls -l|awk '{print $3" "$9}'

Sponsored Links
    #3  
Old Unix and Linux 10-30-2013
Scott's Unix or Linux Image
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 27 May 2016, 8:34 PM EDT
Location: Zürich
Posts: 8,592
Thanks: 339
Thanked 1,089 Times in 946 Posts
If you have the stat command, you can try:


Code:
[scott@ks tmp]$ touch a b c
[scott@ks tmp]$ stat -c "%U %n" *
scott a
scott b
scott c

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find only files/directories with different permissions/owners dheian Shell Programming and Scripting 5 05-12-2013 02:32 AM
I need a script to find socials in files and output a list of those files NewSolarisAdmin Shell Programming and Scripting 1 02-19-2009 12:01 PM
Identifying Semaphore Owners backslash AIX 1 06-04-2006 10:06 PM
Need help from E280R owners Don.Key Solaris 2 06-20-2005 03:20 PM



All times are GMT -4. The time now is 05:52 AM.