category: mac

Mac - Get file user(owner) name & user id

on 2018-11-16

Mac - Get file user name & user id

Get file owner name

stat -f '%Su' <file or folder name>

Get user id

show user

id
// or
id <user name>

get uid

id -u
// or
id -u <user name>

get file owner uid

stat -f ‘%Su’ <file or folder name> | xargs id -u

stat -f '%u' <file or folder name>

Refer - 将Linux命令的结果作为下一个命令的参数

Read more

Mac - Use readlink in Mac OS X

on 2018-10-24

  1. install coreutils
brew install coreutils
  1. test greadlink
greadlink -f <file name>
  1. alias command line
alias readlink=greadlink

refer - How can I get the behavior of GNU’s readlink -f on a Mac?;