Originally Posted by shorte85
I don't know, I am so confused now. lol All I am trying to do is get a list of users who have home directories, but do not have entry in /etc/passwd. But I am not sure if I am wording it correctly as to what I am after.
First of all my apologies - I forgot the character class
braces around my awk regex.
It should have said:
ls -l /home | awk '$3 !~ /[a-zA-Z]/'
I think the basic problem you're facing is that you're
setting (in your mind) a user name to be equivalent to
the name of the users home directory. While this commonly
is the case, it's not always like that, and it's certainly
not required. When you say you want to find a directory
whose owner isn't in /etc/passwd looking at the names is
technically speaking not correct. However, it would appear
that in your practical example output above there's a whole
lot of directories under home owned by two users whose names
aren't reflected in the directories names, namely a user
directory and root.
If the directories above weren't owned by anyone I'd expect
to see something like this in ls' output.
ls -l /home | awk '$3 !~ /[a-zA-Z]/' | more
d---rwx--t 12 1009 aadams01 4096 Sep 21 2006 aadams01
d---rwx--t 5 1019 aadams03 4096 Dec 4 21:31 aadams03
d---rwx--t 4 1005 aadams24 4096 Jan 3 2008 aadams24
d--------- 2 1004 root 4096 Jan 27 13:13 aaebig01