How to restart ssh service on macOS?

How to restart SSH in Mac Pro?

When I used: sudo service ssh restart its shows:

Command not found

sudo service ssh restart, Command not found


Try with:

sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist 

Go to System Preferences > Sharing, uncheck Remote Login, recheck Remote Login.