I would like to control the fan speed using terminal, if possible without third party app.
The idea is to automate and schedule different fan speed.
macOS does not support user control of the fan speed.
The open source project smcFanControl claims to offer fan speed control. Be careful overriding Apple's fan behaviour; you risk damaging your computer.