Sponsored Content
Top Forums UNIX for Beginners Questions & Answers UNIX command to display Owner,Group,Root and Subdirectories list Post 302969193 by vasuvv on Saturday 19th of March 2016 01:12:10 PM
Old 03-19-2016
Hi , I am able to see the list. as it's a big list ( around 10k lines) i am not sure how to copy the entire result set.

So I would like to create a file "Test.txt' and would like to move this result set to test.txt and need to send the test.txt file to my mail.

Please advise.

Thanks

---------- Post updated at 10:42 PM ---------- Previous update was at 10:28 PM ----------

Hi Rudi,

Here is the command am using to find the list
Code:
find . -type d -exec ls -ld {} \; | awk '{print $3,$4,$9}' | egrep  -v "^oasitqtc"

here is the output am getting
Code:
etlndw etlndw ./inform/ndw/ExtLdr/NULOGX
 etlndw etlndw ./inform/ndw/ExtLdr/QAR
 etlndw etlndw ./inform/ndw/ExtLdr/PFSS
 etlndw etlndw ./inform/ndw/ExtLdr/OAR
 etlndw etlndw ./inform/ndw/ExtLdr/SLSTRNS
 inf91etf informat ./inform/ndw/ExtLdr/MDM
 etlndw etlndw ./inform/ndw/ExtLdr/TPM
 etlndw informat ./inform/ndw/ExtLdr/DSHPD
 etlndw informat ./inform/ndw/ExtLdr/MDMSIPS
...................

like this I have 10k records

I would like to copy this list into an excel sheet/.txt by giving file name as "TEST.txt/Test.xlsx" and send this file as an attachment to my Mail.

Please advise.
 

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

NAME
lchown - change the owner and group of a symbolic link SYNOPSIS
#include <unistd.h> int lchown(const char *path, uid_t owner, gid_t group); DESCRIPTION
The lchown() function shall be equivalent to chown(), except in the case where the named file is a symbolic link. In this case, lchown() shall change the ownership of the symbolic link file itself, while chown() changes the ownership of the file or directory to which the sym- bolic link refers. RETURN VALUE
Upon successful completion, lchown() shall return 0. Otherwise, it shall return -1 and set errno to indicate an error. ERRORS
The lchown() function shall fail if: EACCES Search permission is denied on a component of the path prefix of path. EINVAL The owner or group ID is not a value supported by the implementation. ELOOP A loop exists in symbolic links encountered during resolution of the path argument. ENAMETOOLONG The length of a pathname exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. ENOENT A component of path does not name an existing file or path is an empty string. ENOTDIR A component of the path prefix of path is not a directory. EOPNOTSUPP The path argument names a symbolic link and the implementation does not support setting the owner or group of a symbolic link. EPERM The effective user ID does not match the owner of the file and the process does not have appropriate privileges. EROFS The file resides on a read-only file system. The lchown() function may fail if: EIO An I/O error occurred while reading or writing to the file system. EINTR A signal was caught during execution of the function. ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument. ENAMETOOLONG Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}. The following sections are informative. EXAMPLES
Changing the Current Owner of a File The following example shows how to change the ownership of the symbolic link named /modules/pass1 to the user ID associated with "jones" and the group ID associated with "cnd". The numeric value for the user ID is obtained by using the getpwnam() function. The numeric value for the group ID is obtained by using the getgrnam() function. #include <sys/types.h> #include <unistd.h> #include <pwd.h> #include <grp.h> struct passwd *pwd; struct group *grp; char *path = "/modules/pass1"; ... pwd = getpwnam("jones"); grp = getgrnam("cnd"); lchown(path, pwd->pw_uid, grp->gr_gid); APPLICATION USAGE
On implementations which support symbolic links as directory entries rather than files, lchown() may fail. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
chown() , symlink() , 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 LCHOWN(P)
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy