How to view a files owner if username is + 8 chars?
am 03.07.2004 01:13:51 von brandon
I'm a little embarrassed to be asking such a newb question like this,
but how would I view a files owner if username is + 8 chars? Is there a
simple ls option (I couldnt find it) to do this? Or perhaps another
command I am forgetting about? Other then greping the passwd file, how
would one find this information out?
--
Thanks,
Brandon E.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to view a files owner if username is + 8 chars?
am 03.07.2004 01:50:03 von Glynn Clements
Brandon Evans wrote:
> I'm a little embarrassed to be asking such a newb question like this,
> but how would I view a files owner if username is + 8 chars? Is there a
> simple ls option (I couldnt find it) to do this? Or perhaps another
> command I am forgetting about? Other then greping the passwd file, how
> would one find this information out?
The "stat" utility can handle usernames longer than 8 characters.
So can the '%u' directive for "find ... -printf ...".
You can get roughly the same behaviour as "ls -l" with:
find $dir -mindepth 1 -maxdepth 1 -printf '%04m %3n %8u %8g %9s %Tb %Td %TY %f %l\n'
except that the above will expand fields to the specified width but
won't truncate them if they are longer.
Unfortunately, you can't get the permissions in rwxr-xr-x format, you
can't get it display the type (file, directory etc), and you can't get
the variable date/time format (i.e. display the time for recent files,
display the year for older ones).
BTW, "find" also has an "-ls" option, which is similar to "ls -ls",
but that also truncates the user/group to 8 characters.
--
Glynn Clements
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to view a files owner if username is + 8 chars?
am 03.07.2004 05:05:48 von brandon
Glynn Clements wrote:
> Brandon Evans wrote:
>
>
> The "stat" utility can handle usernames longer than 8 characters.
> So can the '%u' directive for "find ... -printf ...".
>
> You can get roughly the same behaviour as "ls -l" with:
>
> find $dir -mindepth 1 -maxdepth 1 -printf '%04m %3n %8u %8g %9s %Tb %Td %TY %f %l\n'
>
nice. stat will work just fine. Thank you!
--
Thanks,
Brandon E.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html