Put a Mac to sleep with command line

Sleep in 15 minutes (= 900 sec) since you run the command (note you don’t have to use sudo):

sleep 900 && pmset sleepnow

or you can go with that approach:

sudo systemsetup -setcomputersleep Never
…
sudo systemsetup -setcomputersleep 60

I never tried the latest one but keep in mind it’s told to use minutes, so “60” would be an hour