Sponsored Content
Top Forums UNIX for Beginners Questions & Answers UNIX command to display Owner,Group,Root and Subdirectories list Post 302969189 by vasuvv on Saturday 19th of March 2016 10:59:47 AM
Old 03-19-2016
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 which am expecting
Code:
Eg :   Server_Name   OWNER    Group     Path ( which shows the entire path)
        --------------------------------------------------------------------------------
           hgr0218        INF         ABC       /home/abc
           hgr0218        NHC        HBC      /home/abc/config
           hgr0218        INF         ABC      /home/abc/bin
....

Thanks,
Vasuv

---------- Post updated at 08:29 PM ---------- Previous update was at 07:56 PM ----------

Code:
find . -type d -exec ls -ld {} \; | awk '{print $3,$4,$9}' | egrep  -v "^oasitqtc"


using this commad am able to see the list but unable to copy the entire list. Can any one advise how to coy the entire list and how can I this copies to list to my mail.

Please advise.

Last edited by Scrutinizer; 03-19-2016 at 01:46 PM.. Reason: Additional code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ls command to list recursively ONLY subdirectories

:confused: ls -dlRr I've tried different combinations of the ls command using the above-mentioned options but none of them are giving me the output I am looking for. Objective: To get a recursive listing of all subdirectories from a particular starting point. For example, if my starting... (5 Replies)
Discussion started by: HLee1981
5 Replies

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

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

4. UNIX for Dummies Questions & Answers

How to display only Owner and directory/sub directory names under particular root

hai, I am new to Unix, I have a requirement to display owner name , directory or sub directory name, who's owner name is not equal to "oasitqtc". (here "oasitqtc" is the owner of the directory or sub directory.) i have a command (below) which will display all folders and sub folders, but i... (6 Replies)
Discussion started by: gagan4599
6 Replies

5. AIX

Unix root directory owner wrong AIX 5.3

The a chown was done and instead of using ./ a / was used and root ownership files got changed. I need to change the ownership of the files/directory back - backups are not working and I am concerned a reboot will not be successful. Can anyone provide the ownership of these files/directories... (6 Replies)
Discussion started by: spike1
6 Replies

6. UNIX for Dummies Questions & Answers

Creating a file where the owner and group is not root

Hi, I'm the root user on my computer, but I'm writing a script that does a lot of file handling. Every time I create a file or directory it automatically requires root privileges. Is there a way I can just create a file that the user can access without a password? For example in my script I... (20 Replies)
Discussion started by: jdilts
20 Replies

7. UNIX for Dummies Questions & Answers

UNIX - command to count number of files in subdirectories

I have a folder named test/ and under that I have multiple directories and in each of the directory I have multiple log files. I want to know how many files exists under each sub directory. test |--quanrantine |--logfile1 |--logfile2 |--spooling |--logfile1 ... (4 Replies)
Discussion started by: ravikirankethe
4 Replies

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

9. 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
FCHOWN(P)						     POSIX Programmer's Manual							 FCHOWN(P)

NAME
fchown - change owner and group of a file SYNOPSIS
#include <unistd.h> int fchown(int fildes, uid_t owner, gid_t group); DESCRIPTION
The fchown() function shall be equivalent to chown() except that the file whose owner and group are changed is specified by the file descriptor fildes. RETURN VALUE
Upon successful completion, fchown() shall return 0. Otherwise, it shall return -1 and set errno to indicate the error. ERRORS
The fchown() function shall fail if: EBADF The fildes argument is not an open file descriptor. EPERM The effective user ID does not match the owner of the file or the process does not have appropriate privilege and _POSIX_CHOWN_RESTRICTED indicates that such privilege is required. EROFS The file referred to by fildes resides on a read-only file system. The fchown() function may fail if: EINVAL The owner or group ID is not a value supported by the implementation. The fildes argument refers to a pipe or socket or an fat- tach()-ed STREAM and the implementation disallows execution of fchown() on a pipe. EIO A physical I/O error has occurred. EINTR The fchown() function was interrupted by a signal which was caught. The following sections are informative. EXAMPLES
Changing the Current Owner of a File The following example shows how to change the owner of a file named /home/cnd/mod1 to "jones" and the group to "cnd". The numeric value for the user ID is obtained by extracting the user ID from the user database entry associated with "jones". Similarly, the numeric value for the group ID is obtained by extracting the group ID from the group database entry associated with "cnd". This example assumes the calling program has appropriate privileges. #include <sys/types.h> #include <unistd.h> #include <fcntl.h> #include <pwd.h> #include <grp.h> struct passwd *pwd; struct group *grp; int fildes; ... fildes = open("/home/cnd/mod1", O_RDWR); pwd = getpwnam("jones"); grp = getgrnam("cnd"); fchown(fildes, pwd->pw_uid, grp->gr_gid); APPLICATION USAGE
None. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
chown() , the Base Definitions volume of IEEE Std 1003.1-2001, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 FCHOWN(P)
All times are GMT -4. The time now is 06:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy