Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

list of file owners in folder on linux

Tags:

linux

shell

I have a folder with many files. The files have been created by many different users. I do not know about shell scripting.

I need to get the list of the username (only) of the owners of the files.

I may save the output of ls -l and then parse it using perl python etc...

But how can i do this using shell scripting?

like image 709
Anupam Avatar asked Oct 07 '10 14:10

Anupam


People also ask

Who is the owner of a file Linux?

User: A user is the one who created the file. By default, whosoever, creates the file becomes the owner of the file. A user can create, delete, or modify the file. Group: A group can contain multiple users.

How do I find the owner of a folder?

The normal method would be to right click on the file in Explorer, select Properties, click the Security tab and click Ownership. This will then show the current owner and give the option to take ownership. You could perform on *. * to list owners for all files in all subdirectories (no need for any /s switch).

What is owner group and others in Linux?

Let's start by talking about the ownership of Linux files. User: the owner of the file (person who created the file). Group: the group can contain multiple users. Therefore, all users in that group will have the same permissions. It makes things easier than assign permission for every user you want.

How many group owners can a file have in Linux?

File ownership and permissions. Just as every user has an ID and is a member of one primary group, so every file on a Linux system has one owner and one group associated with it.


1 Answers

stat -c "%U" *| sort -u
like image 166
ghostdog74 Avatar answered Sep 22 '22 15:09

ghostdog74