Re: How to view a files owner if username is + 8 chars?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux