Retrieving boolean values of System Properties (Terminal commands)

command linefinderterminal

I am familiar with the state changes to system properties (such as displaying hidden files) using Terminal commands including: defaults write com.apple.finder AppleShowAllFiles YES to make the any hidden files become visible.

But what is the command for showing the current state/status of this (and similar) properties, to retrieve what it is set to, without changing the value?

During my initial tinkering, I've already trying appending a STATUS value in place of the YES or NO option; without any luck.

I'm certain there must be a command that returns the current state of the boolean or enumerated type's property, such that entering a variation of the above-mentioned command (to show hidden files) will not perform any changes but rather return the current setting i.e. YES or NO.

I am out of ideas and appreciate the help.

Best Answer

The read qualifier shows the value:

$ defaults write com.apple.finder AppleShowAllFiles 1

$ defaults read com.apple.finder AppleShowAllFiles
1

$ defaults write com.apple.finder AppleShowAllFiles 0

$ defaults read com.apple.finder AppleShowAllFiles
0

The man defaults Terminal command gives a wealth of information.