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: 11 May 2015, 9:03 PM EDT
Posts: 64
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: 29 June 2015, 8:34 PM EDT
Location: Swissh
Posts: 991
Thanks: 196
Thanked 175 Times in 159 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: 29 June 2015, 1:20 PM EDT
Location: Zürich
Posts: 8,568
Thanks: 337
Thanked 1,080 Times in 938 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
Script to check the owners & permissions Dr.Matrix Shell Programming and Scripting 7 05-02-2010 10:48 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 01:16 AM.