Sponsored Content
Top Forums UNIX for Advanced & Expert Users Is there a command to get the owner of a file? Post 302235831 by Franklin52 on Saturday 13th of September 2008 07:02:53 AM
Old 09-13-2008
Try the stat command:
Code:
stat -c %U file

Regards
 

10 More Discussions You Might Find Interesting

1. Solaris

Owner of file gets 'not owner' error for chgrp

Hi Folks, I know that changing users and groups is pretty basic admin, but this one has got me stumped. When I try to change the group of a file for which I am the owner for, it still gives me a 'Not owner' error. For example, when I am logged in as 'webadmin', I have the following file: ... (4 Replies)
Discussion started by: brizrobbo
4 Replies

2. Shell Programming and Scripting

how to extract owner from find command

hi how can I extract the owner of the file from the find command that I used below find /home -type f -atime +5 I tried something like this but didnt work. find /home -type f -atime +5 -ls |cut -f5 (5 Replies)
Discussion started by: tjay83
5 Replies

3. UNIX for Dummies Questions & Answers

command to find the files under particular owner

Hi, I need a command to find a files under particular owner ?All the files in the system for the particular user id is the owner? Please help me on this? (2 Replies)
Discussion started by: jayaramanit
2 Replies

4. UNIX for Dummies Questions & Answers

How to know owner of a file without ls and find command

How to know owner of a file without ls and find command :p (1 Reply)
Discussion started by: swat
1 Replies

5. UNIX for Advanced & Expert Users

How UNIX admin set up this? how files of 744 of other owner can be removed by another owner?

Hi all, We have some files are under 744 permissions and the the owner is say owner1 and group1. Now we have another user owner2 of group2, owner2 can remove files of the owner1 and the permission of those files are 744, unix admin told us he did some config at his side so we can do that. ... (14 Replies)
Discussion started by: TheGunMan
14 Replies

6. UNIX for Advanced & Expert Users

command to find the owner of a db

Hi, Im working with an Informix db, i would like to know the command to identify the owner of a particular database Thanks (2 Replies)
Discussion started by: dvah
2 Replies

7. Shell Programming and Scripting

rm/mv command - not owner

Hi, I have two users, either of them can create a file. Either of them should be able to move/remove the file. When trying to do that I am getting error "Not owner". I have many times seen that we could "rm" or atleast "mv" even if the user is not the owner of the file. Does this have... (2 Replies)
Discussion started by: tostay2003
2 Replies

8. Solaris

Privileges : modify dir/file owner by other that's not owner

i need to do the following operations in solaris 10: 1.change owner and group owner for files which are not owned by the current user and user group 2.to can delete files in the /tmp directory which are not of the current user 3. allow to a standard user the deletion of files in the /tmp... (1 Reply)
Discussion started by: sirmark
1 Replies

9. AIX

Command or script to inform server owner about process

Hi all, How to inform server owner if the particular process is down. I need command or script to do the above. TIA (3 Replies)
Discussion started by: sumanthupar
3 Replies

10. UNIX for Beginners Questions & Answers

UNIX command to display Owner,Group,Root and Subdirectories list

Hi Team, Am a newbie to Unix. As I would like to see the Server Name,Owner Name ( not numeric form), Group Name ( not numeric ID), ROOT path. I would like to send this list as an attachment to my personal mail. Can any one please help me out to to resolve this . Here is the sample result... (6 Replies)
Discussion started by: vasuvv
6 Replies
File::stat(3pm) 					 Perl Programmers Reference Guide					   File::stat(3pm)

NAME
File::stat - by-name interface to Perl's built-in stat() functions SYNOPSIS
use File::stat; $st = stat($file) or die "No $file: $!"; if ( ($st->mode & 0111) && $st->nlink > 1) ) { print "$file is executable with lotsa links "; } use File::stat qw(:FIELDS); stat($file) or die "No $file: $!"; if ( ($st_mode & 0111) && $st_nlink > 1) ) { print "$file is executable with lotsa links "; } DESCRIPTION
This module's default exports override the core stat() and lstat() functions, replacing them with versions that return "File::stat" objects. This object has methods that return the similarly named structure field name from the stat(2) function; namely, dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, and blocks. You may also import all the structure fields directly into your namespace as regular variables using the :FIELDS import tag. (Note that this still overrides your stat() and lstat() functions.) Access these fields as variables named with a preceding "st_" in front their method names. Thus, "$stat_obj->dev()" corresponds to $st_dev if you import the fields. To access this functionality without the core overrides, pass the "use" an empty import list, and then access function functions with their full qualified names. On the other hand, the built-ins are still available via the "CORE::" pseudo-package. BUGS
As of Perl 5.8.0 after using this module you cannot use the implicit $_ or the special filehandle "_" with stat() or lstat(), trying to do so leads into strange errors. The workaround is for $_ to be explicit my $stat_obj = stat $_; and for "_" to explicitly populate the object using the unexported and undocumented populate() function with CORE::stat(): my $stat_obj = File::stat::populate(CORE::stat(_)); NOTE
While this class is currently implemented using the Class::Struct module to build a struct-like class, you shouldn't rely upon this. AUTHOR
Tom Christiansen perl v5.8.0 2002-06-01 File::stat(3pm)
All times are GMT -4. The time now is 12:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy