Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to find owner of file or folder?



In the last episode (Feb 27), TJ Luoma said:
> This is the only way that I know of to get the username who owns a
> certain file or folder, such as /usr/local/
> 
>           command ls -ld /usr/local | awk '{print $3}'
> 
> (or `ls -dn` if you want the number instead of the name)
> 
> but that seems fairly inelegant.
> 
> Is there a better way?

$ zmodload zsh/stat
$ zstat -H fileinfo /usr/local
$ echo $fileinfo[uid]
0
$ ls -ld /usr/local
drwxr-xr-x  42 root  wheel  42 Feb 19 17:05 /usr/local/
$ typeset fileinfo
fileinfo=(atime 1313171206 blksize 4096 blocks 5 ctime 1329692755 device
 4201426224 gid 0 inode 3366 link '' mode 16877 mtime 1329692755 nlink 42
 rdev 4294967295 size 42 uid 0 )

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author