How to add new keystrokes to the system settings from Terminal I am currently creating a list of terminal commands to set up a new mac system according to my needs. Now I would like to add new keystrokes to Preview (normally in the system settings => keyboard) from the Terminal. This is probably possible using the defaults write command but so far, I haven't found the concrete plist or path I would have to change.

Has anybody already tried this or knows a good resource for such settings?
You can add an NSUserKeyEquivalents dictionary to ~/Library/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.plist.

defaults write -app preview NSUserKeyEquivalents '{
"Single Page" = "@1";
"Two Pages" = "@2";
"Continuous Scroll" = "@3";
"Adjust Size..." = "~@i";
"Adjust Color..." = "@u";
}'


The shortcuts for all applications are in ~/Library/Preferences/.GlobalPreferences.plist.

defaults write -g NSUserKeyEquivalents '{
"Show in Finder" = "$@r";
"Reveal" = "$@r";
"Delete Row" = "~@\b";
"Delete Rows" = "~@\b";
"Delete Column" = "$@\b";
"Delete Columns" = "$@\b";
"Minimize" = "\0";
"Minimize All" = "\0";
}'


The shortcut format is described in the Cocoa Text System article. The -app option doesn't work with some applications like Finder or Notes. If a menu item was assigned to nil, pressing L would trigger it in Audacity.