The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
command to find the files under particular owner jayaramanit UNIX for Dummies Questions & Answers 2 08-22-2008 11:08 AM
how to extract owner from find command tjay83 Shell Programming and Scripting 5 08-12-2008 01:21 AM
determine owner of a file unibboy Shell Programming and Scripting 4 01-26-2008 11:39 AM
Owner of file gets 'not owner' error for chgrp brizrobbo SUN Solaris 4 12-18-2007 02:30 PM
change owner of a file CBarraford UNIX for Dummies Questions & Answers 3 03-03-2007 08:37 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-13-2008
Registered User
 

Join Date: Sep 2008
Posts: 7
Is there a command to get the owner of a file?

At the moment I'm just using `ls -o` (with `cut`), but `ls` is obviously giving me a lot more output than just the file owner.
Reply With Quote
Forum Sponsor
  #2  
Old 09-13-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,328
Try the stat command:
Code:
stat -c %U file
Regards
Reply With Quote
  #3  
Old 09-13-2008
Registered User
 

Join Date: Sep 2008
Posts: 7
Thanks a lot, I didn't know about the `stat` command, but I was sure something like this must exist. The operators of the official Ubuntu support channel told me that parsing `ls` was the only way, haha.
Reply With Quote
  #4  
Old 09-13-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,328
Quote:
Originally Posted by Bilge View Post
Thanks a lot, I didn't know about the `stat` command, but I was sure something like this must exist. The operators of the official Ubuntu support channel told me that parsing `ls` was the only way, haha.
So, stay tuned here...
Reply With Quote
  #5  
Old 09-13-2008
Registered User
 

Join Date: Sep 2008
Posts: 7
Well yes, I get the impression that people actually know what they're talking about here and are not in the habit of spreading misinformation.
Reply With Quote
  #6  
Old 09-13-2008
Resident BOFH
 

Join Date: Dec 2007
Posts: 262
Quote:
Originally Posted by Bilge View Post
Well yes, I get the impression that people actually know what they're talking about here and are not in the habit of spreading misinformation.
fyi - the stat command is not standard and does not exist on all UNIX variants. for example - AIX uses the istat command.
Reply With Quote
  #7  
Old 09-13-2008
Registered User
 

Join Date: Sep 2008
Posts: 7
Well yes I had noticed that it resided in /usr/bin.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0