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


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to know owner of a file without ls and find command
# 1  
Old 12-03-2008
How to know owner of a file without ls and find command

How to know owner of a file without ls and find command Smilie
# 2  
Old 12-03-2008
using the stat syscall
f.eg in perl
@fstat=stat("file") or die("cannot stat file");
@owner=getpwuid($fstat[4]);
printf "%s;%s;%s;%s;%s\n", $f, $owner[0], $fstat[7], $fstat[8], "$fstat[10]" ;
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

How to find DL Owner info using ldapsearch?

Currently i have following syntax: ldapsearch -D "CN=..,OU=..,OU=All Businesses,DC=..,DC=..,DC=.." -w .. -h .. -p .. -b "OU=All Businesses,DC=..,DC=..,DC=.." "managedObjects=$DL_NAME_CN" employeeNumber givenName sn -S employeeNumber -x which gives me following info: "requesting:... (0 Replies)
Discussion started by: arsenghani
0 Replies

3. 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

4. Shell Programming and Scripting

Find user owner of the most recently file in the system

Good evening everybody, I have to find the user owner of the most recently file in the system How can I do? :confused: (5 Replies)
Discussion started by: Guccio
5 Replies

5. Shell Programming and Scripting

find files by OWNER

i have written a script in which i have to go to a dir and search there for files belonging to owner pipe and then delete them Can anyone tell me how to find files by owner pipe. below some of the files belonging to owner pipe -rw------- 1 pipe pipe 163840 Mar 18 2008 ... (7 Replies)
Discussion started by: ali560045
7 Replies

6. UNIX for Dummies Questions & Answers

Find files by owner

Hello, I have a problem, I need to find files in folder by owner, not using find command at all and ls -R parameter. Thanx a lot. Best regarts (1 Reply)
Discussion started by: Boliakas
1 Replies

7. UNIX for Advanced & Expert Users

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. (9 Replies)
Discussion started by: Bilge
9 Replies

8. 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

9. 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

10. 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
Login or Register to Ask a Question