Home
Man
Search
Today's Posts
Register

Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Is there a command to get the owner of a file?

Tags
advanced, command, file

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 09-13-2008
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.
# 2  
Old 09-13-2008
Try the stat command:
Code:
stat -c %U file

Regards
# 3  
Old 09-13-2008
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.
# 4  
Old 09-13-2008
Quote:
Originally Posted by Bilge
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...
# 5  
Old 09-13-2008
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.
# 6  
Old 09-13-2008
Quote:
Originally Posted by Bilge
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.
# 7  
Old 09-13-2008
Well yes I had noticed that it resided in /usr/bin.
Login to Reply

« Previous Thread | Next Thread »
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
UNIX command to display Owner,Group,Root and Subdirectories list vasuvv UNIX for Beginners Questions & Answers 6 03-20-2016 07:42 PM
Command or script to inform server owner about process sumanthupar AIX 3 09-12-2013 12:28 PM
Privileges : modify dir/file owner by other that's not owner sirmark Solaris 1 06-18-2012 10:47 AM
rm/mv command - not owner tostay2003 Shell Programming and Scripting 2 03-09-2011 11:06 AM
command to find the owner of a db dvah UNIX for Advanced & Expert Users 2 06-24-2010 04:39 AM
How UNIX admin set up this? how files of 744 of other owner can be removed by another owner? TheGunMan UNIX for Advanced & Expert Users 14 01-18-2010 10:04 AM
How to know owner of a file without ls and find command swat UNIX for Dummies Questions & Answers 1 12-03-2008 07:05 AM
command to find the files under particular owner jayaramanit UNIX for Dummies Questions & Answers 2 08-22-2008 03:08 PM
how to extract owner from find command tjay83 Shell Programming and Scripting 5 08-12-2008 05:21 AM
Owner of file gets 'not owner' error for chgrp brizrobbo Solaris 4 12-18-2007 05:30 PM


All times are GMT -4. The time now is 02:56 AM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password