Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Group files by owner and show directory Post 302518753 by dealer1985 on Sunday 1st of May 2011 06:22:59 PM
Old 05-01-2011
Group files by owner and show directory

Hello, i would like to find huge files and group them by owners.
To find big files i use this command:
Code:
ls -lR | sort -bnr +4 | head -n 75

which give me 75 biggest files, then i need to see in which subdirectory is every file.
second thing i dont know is how to group those files by owner, could someone help me?, have no idea how to do it.

Was trying to play with 'find' command etc but it dont work like i want
The structure i would like to get is following
Code:
name_user1
drwxr-xr-x   4 user1     root           7 Feb 22  2007 file1
drwxr-xr-x   4 user1     root          15 Feb 23  2007 file2
drwxr-xr-x   4 user1     root          20 Apr 13  2007 file3
drwxr-xr-x   5 user1     root          32 Jul 19  2007 file4
drwxr-xr-x   4 user1     root          46 Jul 30  2007 file5
drwxr-xr-x   5 user1     root          56 Sep 20  2007 file6
dr-xr-xr-x   5 user1     sys           67 Mar 24  2008 file7
name_user2                                             
drwxr-xr-x   8 user2     other          9 Jun 16  2008 file1
drwxr-xr-x   6 user2     root          19 Oct 10 12:50 file2
drwxr-xr-x   5 user2     root          26 Oct 14 18:17 file3
drwxr-xr-x   2 user2     root          35 Nov 13 13:37 file4
drwxr-xr-x  76 user2     root          46 Nov 21 09:01 file5
drwxr-xr-x   6 user2     root          58 Nov 27 07:34 file6
drwxr-xr-x  11 user2     root          62 Jan 12 15:39 file7
drwxr-xr-x   5 user2     root          95 Jan 12 15:57 file8
name_user3                                             
drwxr-xr-x   3 user3     root           3 Jan 13 09:01 file1
drwxr-xr-x   3 user3     other          8 Jan 13 11:17 file2
drwxrwxr-x   5 user3     other         61 Jan 13 13:01 file3

i know that i can get user_name from /etc/passwd but how to make it so nice ordered?
Thanks for you help
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

owner and group in Linux

I am bit unclear of how Linux was set in the real world, please advise me how it's supposed to be. When I log in as root and do a ls -l, I find: /boot, /, /var, /usr, /tmp, /home, /u01, /u02, /u03 and of of this partition is owned by root and the group also belong to root. Is that the way it's... (1 Reply)
Discussion started by: lapnguyen
1 Replies

2. Shell Programming and Scripting

permission, owner and group

hello I search a script (ksh for Aix 5.3) to save all permissions, groups and owner for all files. Because we work much to change it, and a mystake ......! So i want execute this script to save/ execute permissions for all files. If you have this script, thank you for your help ;) best... (2 Replies)
Discussion started by: pascalbout
2 Replies

3. Shell Programming and Scripting

to parse a directory and its subdirectories and find owner name of files

hi all, i need to capture all the files in a directory and its subdirectories that have owner name different than the root owner. for one file it is " stat -c %U filename " but i need to search for each and every file and record it. thanks in advance (14 Replies)
Discussion started by: vyasa
14 Replies

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

5. UNIX for Dummies Questions & Answers

Finding the Group Owner Name

Hi all, How can i find the group owner name...??? Thanks (4 Replies)
Discussion started by: mansahr143
4 Replies

6. Emergency UNIX and Linux Support

To identify the group owner

If I have to identify the group owner of an AIX group, what is the command to be used. Example: there is an mqadm group, how do I find the owner of this group? Please help. (6 Replies)
Discussion started by: ggayathri
6 Replies

7. AIX

Files without owner and group

Dears it is normal that the below binaries stay without any owner and group I have checked it in many servers and the like the below /usr/lpp/bos.net/inst_root/etc/ipsec# ls -lrt total 248 -r-xr-xr-x 1 987 987 13589 Jun 29 2005 default_group -r-xr-xr-x ... (5 Replies)
Discussion started by: thecobra151
5 Replies

8. AIX

How to set owner and permission for files/directory in directory in this case?

Hi. My example: I have a filesystem /log. Everyday, log files are copied to /log. I'd like to set owner and permission for files and directories in /log like that chown -R log_adm /log/* chmod -R 544 /log/*It's OK, but just at that time. When a new log file or new directory is created in /log,... (8 Replies)
Discussion started by: bobochacha29
8 Replies

9. Shell Programming and Scripting

Search for files owned by particular owner and group

I am searchingfor files owned by particular owner and group in a particular directory including its sub-directories. I use find <dir> -user <user> -group <group> -exec ls -l {} \; It does not work completely. In the sense is a subdirectory is owned by 'user' and group 'group' then all... (9 Replies)
Discussion started by: Soham
9 Replies

10. Shell Programming and Scripting

List files whose owner or group is numeric

I want to add a condition is my find command to include files/sub-directory whose owner or group is all numeric number. My current find command is find . \( -user root -o -user soham\) -type f -exec ls -l {} \; 2>&1 ---------- Post updated at 10:20 AM ---------- Previous update was at... (5 Replies)
Discussion started by: Soham
5 Replies
rcp(1c) 																   rcp(1c)

Name
       rcp - remote file copy

Syntax
       rcp [ -p ] file1 file2
       rcp [-r] [-p] file... directory

Description
       The command copies files between machines.  Each file or directory argument is either a remote file name of the form rhost:path, or a local
       file name.  Local file names do not contain colons (:) or backslashes () before colons.

       Note that the command refuses to copy a file onto itself.

       If path is not a full path name, it is interpreted relative to your login directory on rhost.  To ensure that the metacharacters are inter-
       preted  remotely,  a  remote  host's  path  can be quoted by either using a backslash () before a single character, or enclosing character
       strings in double (") or single (') quotes.

       The command does not prompt for passwords; your current local user name must exist on rhost and allow remote command execution via

       The command handles third party copies, where neither source nor target files are on the current machine.  Hostnames may also take the form
       rname@rhost  to	use rname rather than the current user name on the remote host.  The following example shows how to copy the file foo from
       user1@mach1 to user2@mach2:
	$ rcp user1@mach1:foo  user2@mach2:foo
       Note that the file .rhosts on mach2 in user2's account must include an entry for mach1 user1.  Also note that it may be necessary  for  the
       person implementing the command to be listed in the .rhosts file for mach1 user1.

       By  default,  the mode and owner of file2 are preserved if file2 already exists.  Otherwise, the mode of the source file modified by on the
       destination host is used.

Options
       -p   Preserves the modification times and modes of the source files in its copies, ignoring the

       -r   Copies files in all subdirectories recursively, if the file to be copied is a directory.  In this  case  the  destination  must  be  a
	    directory.

Restrictions
       The  command  is  confused by output generated by commands in a .cshrc file on the remote host.	In particular, `where are you?' and `stty:
       Can't assign requested address' are messages which can result if output is generated by the startup file.

See Also
       ftp(1c), rlogin(1c), rsh(1c)

																	   rcp(1c)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy