$ dscl .
> help
dscl (v11.2)
usage: dscl [options] [<datasource> [<command>]]
datasource:
localhost (default) or
localonly (activates a DirectoryService daemon process
with Local node only - daemon quits after use
<hostname> (requires DS proxy support, >= DS-158) or
<nodename> (Directory Service style node name) or
<domainname> (NetInfo style domain name)
options:
-u <user> authenticate as user (required when using DS Proxy)
-P <password> authentication password
-p prompt for password
-f <filepath> targeted file path for DS daemon running in localonly mode
(example: /Volumes/Build100/var/db/dslocal/nodes/Default)
(NOTE: Nodename to use is fixed at /Local/Target)
-raw don't strip off prefix from DS constants
-plist print out record(s) or attribute(s) in XML plist format
-url print record attribute values in URL-style encoding
-q quiet - no interactive prompt
commands:
-read <path> [<key>...]
-readall <path> [<key>...]
-readpl <path><key><plistpath>
-readpli <path><key><valueindex><plistpath>
-create <recordpath> [<key> [<val>...]]
-createpl <recordpath><key><plistpath><val1> [<val2>...]
-createpli <recordpath><key><valueindex><plistpath><val1> [<val2>...]
-delete <path> [<key> [<val>...]]
-deletepl <recordpath><key><plistpath> [<val>...]
-deletepli <recordpath><key><valueindex><plistpath> [<val>...]
-list <path> [<key>]
-append <recordpath><key><val>...
-merge <recordpath><key><val>...
-change <recordpath><key><oldvalue><newvalue>
-changei <recordpath><key><valueindex><newvalue>
-diff <firstpath><secondpath>
-search <path><key><val>
-auth [<user> [<password>]]
-authonly [<user> [<password>]]
-passwd <userpath> [<newpassword> | <oldpassword><newpassword>]
MCX Extensions:
-mcxread <recordpath> [optArgs] [<appDomain> [<keyName>]]
-mcxset <recordpath> [optArgs] <appDomain><keyName> [<mcxDomain> [<keyValue>]]
-mcxedit <recordpath> [optArgs] <appDomain><keyPath> [<keyValue>]
-mcxdelete <recordpath> [optArgs] [<appDomain> [<keyName>]]
-mcxdeleteall <recordpath> [optArgs] [<appDomain> [<keyName>]]
-mcxexport <recordpath> [optArgs] [<appDomain> [<keyName>]]
-mcximport <recordpath> [optArgs] <filepath>
-mcxhelp
>
列出 dscl 中所有的数据目录
$ dscl .> ls
AFPUserAliasesAliasesAutomountAutomountMapComputerGroupsComputerListsComputersConfigEthernetsGroupsHostsMountsNetGroupsNetworksPeoplePresetComputerGroupsPresetComputerListsPresetComputersPresetGroupsPresetUsersProtocolsServicesSharePointsUsers