What is difference "defaults read" and "defaults export"?

The output from defaults read is sent to standard output in human readable format.

The output from defaults export is put in the file that you specify in the command in binary format.

The problem with your defaults export example:

  • you redirected the standard output to the file: ~/Desktop/com.apple.sidebarlists.plist (using >) and defaults export doesn't send anything to standard output; the result was a file that had nothing in it.
  • defaults export requires that you specify an output file in the command. Including the redirection operator (>) before the filename redirected standard output to that file and effectively removed the filename from the command (since redirection of input or output effectively happens prior to command parsing) Thus no output file was specified which resulted in the error message saying that you need "a path to write to".

Depending on what changes you are making:

  • if possible, use the Finder's Preferences… to change things.
  • if Preferences… can't accomplish what you need then it's probably easiest to use defaults read to produce output in a form that you can easily edit and then use defaults write 'plist' (see man documentation) to "install" your changes.
  • there are other ways to do what you want of varying degrees of difficulty.

I'll just mention that the documentation for the defaults command states:

Defaults can be structured in very complex ways, making it difficult for the user to enter them with this command.