linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to view a files owner if username is + 8 chars?
@ 2004-07-02 23:13 Brandon Evans
  2004-07-02 23:50 ` Glynn Clements
  0 siblings, 1 reply; 3+ messages in thread
From: Brandon Evans @ 2004-07-02 23:13 UTC (permalink / raw)
  To: Linux Admin


	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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to view a files owner if username is + 8 chars?
  2004-07-02 23:13 How to view a files owner if username is + 8 chars? Brandon Evans
@ 2004-07-02 23:50 ` Glynn Clements
  2004-07-03  3:05   ` Brandon Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Glynn Clements @ 2004-07-02 23:50 UTC (permalink / raw)
  To: Brandon Evans; +Cc: Linux Admin


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 <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to view a files owner if username is + 8 chars?
  2004-07-02 23:50 ` Glynn Clements
@ 2004-07-03  3:05   ` Brandon Evans
  0 siblings, 0 replies; 3+ messages in thread
From: Brandon Evans @ 2004-07-03  3:05 UTC (permalink / raw)
  To: Glynn Clements; +Cc: Linux Admin

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-03  3:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-02 23:13 How to view a files owner if username is + 8 chars? Brandon Evans
2004-07-02 23:50 ` Glynn Clements
2004-07-03  3:05   ` Brandon Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).