zsh-users
 help / color / mirror / code / Atom feed
From: Dan Nelson <dnelson@allantgroup.com>
To: TJ Luoma <luomat@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: How to find owner of file or folder?
Date: Mon, 27 Feb 2012 11:31:51 -0600	[thread overview]
Message-ID: <20120227173150.GH59682@dan.emsphone.com> (raw)
In-Reply-To: <CADjGqHuYfi4h+2OgNouuc3RXpHYexOnqr0ExLUax7H+uFkQg3g@mail.gmail.com>

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@allantgroup.com


  reply	other threads:[~2012-02-27 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 16:55 TJ Luoma
2012-02-27 17:31 ` Dan Nelson [this message]
2012-02-27 18:30   ` TJ Luoma
2012-02-27 18:38     ` Dan Nelson
2012-02-27 19:55       ` TJ Luoma
2012-02-27 17:35 ` Danek Duvall
2012-02-27 17:37 ` Peter Stephenson
2012-02-27 18:18   ` TJ Luoma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120227173150.GH59682@dan.emsphone.com \
    --to=dnelson@allantgroup.com \
    --cc=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).