TogaMario
asked on
How do I list all files in all the user home directories?
I would think something similar to this would do what I need, but it seems to take the <directory>/* literally, and not as I mean it to.
cut -d : -f 6 /etc/passwd | xargs -I{} grep umask {}/.*
For example, the output to this produces "No such file or directory" for all entries:
grep: /home/user1/.*: No such file or directory
grep: /home/user2/.*: No such file or directory
Even though user1 and user2 both have home directories with files in them.
I am running as root as well.
Thanks,
-Tyler
cut -d : -f 6 /etc/passwd | xargs -I{} grep umask {}/.*
For example, the output to this produces "No such file or directory" for all entries:
grep: /home/user1/.*: No such file or directory
grep: /home/user2/.*: No such file or directory
Even though user1 and user2 both have home directories with files in them.
I am running as root as well.
Thanks,
-Tyler
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>How do I list all files in all the user home directories?
Modifying your command, if you want to list all files in the user home directory recursively :
cut -d : -f 6 /etc/passwd | xargs ls -lR
Best Regards
Didit
Modifying your command, if you want to list all files in the user home directory recursively :
cut -d : -f 6 /etc/passwd | xargs ls -lR
Best Regards
Didit
ASKER
I appreciate the extra mile, but if I did that then the root user would return everything on the file system (which I could just as easily "grep -v" out, but for my intent of use I think the first example proves to be the best. I'll try to be a little more detailed in my description next time.
Thanks again!
Thanks again!
ASKER