I am trying to get the username of the person who modified a specific file:
stat -c "%u" somefilename.name
this script returns a number like 544
what does that mean? i was hoping to get the username like myUsername
?
I am trying to get the username of the person who modified a specific file:
stat -c "%u" somefilename.name
this script returns a number like 544
what does that mean? i was hoping to get the username like myUsername
?
You get the numerical userid from this commmand (edit: the userid of the owner, not the user who last modified the file). To get the related username, try getent passwd 544
(I have no idea if that works like this on Cygwin).
You can try to combine these commands:
getent passwd $(stat -c "%u" somefilename.name)
It is the ID of the user. Issue:
awk -F: '{if ($3 == "544") print $1;}' /etc/passwd
to see the account name.
Now, you'll see Administrators
, which probably isn't very helpful for you, but that's how Cygwin sees the owner.
See http://cygwin.com/cygwin-ug-net/ntsec.html and especially chapter Example 3.3. /etc/passwd
there for more information.