Is there any way to handle the equivalent of Python's GPIO.cleanup() via the terminal ?
A Small Bash script/python script will do the job. Run it on raspberry Pi.
RPi.GPIO provides a built-in function GPIO.cleanup() to clean up all the ports you’ve used. But be very clear what this does. It only affects any ports you have set in the current program. It resets any ports you have used in this program back to input mode. This prevents damage from, say, a situation where you have a port set HIGH as an output and you accidentally connect it to GND (LOW), which would short-circuit the port and possibly fry it. Inputs can handle either 0V (LOW) or 3.3V (HIGH), so it’s safer to leave ports as inputs.
import RPi.GPIO as GPIO # the rest of your code would go here # when your code ends, the last line before the program exits would be... GPIO.cleanup() # remember, a program doesn't necessarily exit at the last line!
For more in-depth check this link.