How can I dim the screen from Terminal?

You can do it via an Applescript and run it as such:

dimmer:

tell application "System Events"
    key code 107
end tell

brighter:

tell application "System Events"
    key code 113
end tell

You can save these as .script file and then run them from the CLI like this:

osascript ~/Path/to/File
Show your support

Clapping shows how much you appreciated Nattaphon Saelim’s story.