O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

dscl

Synopsis

dscl [options] [datasource [command]]

Allows operations on Directory Service nodes, as a replacement to the older niutil.

Options

-p

Prompt for password.

-P password

Use password as the password. Use -p to be prompted for a password.

-q

Quiet mode.

-raw

Doesn't strip the dsAttrType prefixes from DirectoryService API constants.

-u user

Run as user user.

-url

Print record attribute values in URL-style encoding. This can help if your values have spaces or colons in them.

Commands

-read path [ key(s) ]

Reads and displays the contents of the directory at path, one key/value pair per line. If any key(s) are specified, only those keys are listed.

-list path [ key ]

Displays the subdirectories in path. If key is specified, only those keys are listed.

-search path key val

Searches path for the matching key/val pair. For example, to find a specific user by real name, use dscl . -search /Users RealName "Andy Lester".

-create path [ key [ val(s) ]]

Creates a directory at path, including the optional property key and optional values val(s). Note that if the property key already exists, it will be overwritten with the new key and values.

-append path key val(s)

Appends values to the property key at path. If key does not exist, it will be created.

-merge path key val(s)

Appends values to the property key at path. Any values in val(s) that already exist will be ignored. If key does not exist, it will be created.

-delete path [ key [ val(s) ]]

Deletes directories, keys, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required