How can one open a specific tab in preferences via Terminal?
You can use AppleScript from Terminal using osascript:

osascript -e "tell application \"System Preferences\"" -e "set the current pane to pane id \"com.apple.preference.keyboard\"" -e "reveal anchor \"shortcutsTab\" of pane id \"com.apple.preference.keyboard\"" -e "activate"  -e "end tell"

Replace ‘shortcutsTab’ with one of ‘keyboardTab’, ‘InputSources’, ‘shortcutsTab’, ‘Text’, ‘Dictation’ or ‘keyboardTab_ModifierKeys’ to change the tab it opens.

To find the list of available tabs in other preference panes, use
osascript -e "tell application \"System Preferences\"" -e "set the current pane to pane id \"com.apple.preference.name\"" -e "get the name of every anchor of pane id \"com.apple.preference.name\"" -e "end tell" where ‘name’ is the name of the preference pane.



To select a specific category of shortcut, you can use System Events to select a row from the left table.

osascript -e "tell application \"System Preferences\"" \
          -e   "set the current pane to pane id \"com.apple.preference.keyboard\"" \
          -e   "reveal anchor \"shortcutsTab\" of pane id \"com.apple.preference.keyboard\"" \
          -e "end tell" \
          -e "tell application \"System Events\"" \
          -e   "tell application process \"System Preferences\"" \
          -e     "repeat while not (window 1 exists)" \
          -e     "end repeat" \
          -e     "tell window 1" \
          -e       "repeat while not (row 1 of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)" \
          -e       "end repeat" \
          -e       "select row i of table 1 of scroll area 1 of splitter group 1 of tab group 1" \
          -e     "end tell" \
          -e   "end tell" \
          -e "end tell" \
          -e "tell application \"System Preferences\"" \
          -e   "activate" \
          -e "end tell"

‘i’ is the index (counting from 1) of the row in the left column of the preference pane tab. The new lines (using ‘\’ on the previous line) and white space outside of speech marks are just for formatting and can be omitted.

Be careful of the use of ‘repeat while not’ which waits for System Preferences to open to the necessary page, however this freezes the code until that point, and if System Preferences is preoccupied with something else such as logging in to iCloud which can't be interrupted, this will freeze until you manually quit.