Operating System - HP-UX
1820595 Members
1350 Online
109626 Solutions
New Discussion юеВ

How to list file owned by a user?

 
Yap Yen Nee
Contributor

How to list file owned by a user?

I am running HP-UX 11i here.
Under a particular directory, what is the command to list the files owned by a particular user? Can the ls command cater for this?

Thank you.
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: How to list file owned by a user?

ls -la | grep username

ls -lRa | grep username

its a two part command, basically saying filter all output by username.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: How to list file owned by a user?

Hi,

You can use -user switch with find command

find /your_directory -user username

You can also use 'ls' but you will have to pipe the output as there is no argument for ls to accept as user.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Nguyen Anh Tien
Honored Contributor

Re: How to list file owned by a user?

Just type this command
#find /tmp -user john -print
HP is simple