I want to read all home directories of users on a Linux system. I know I can use:
cut -d':' -f6 /etc/passwd | sort -u
to get a list of those directories.
How can I list each of those directories in detailed format, as when using ls -l
?
For example, I would expect to get the root directory as:
dr-xr-x---. 4 root root 4096 Mar 2 02:49 root
Is there any option to pipe the list from the cut
command to ls
for showing the content?
I think this is what you're looking for:
cut -d':' -f6 /etc/passwd | sort -u | xargs -i% ls -ld %