macbook 显示本机所有用户及用户组

mac 操作系统和linux还是不一样的,有些linux命令及参数在mac上还是不好使,
就像查看本机的用户及用户所属组,在mac上本机及所属的组的命令如下:

显示所有users对应的group:
$ sudo dscl . -list /groups GroupMembership

添加user到group:
$ sudo dscl . -append /Groups/groupname GroupMembership username

从group中删除user:
$ sudo dscl . -delete /Groups/groupname GroupMembership username

You May Also Like