Traditionally ubuntu supported a fairly blunt method of suspend and hibernate. Neither would integrate well with other apps and sometimes not even work on some machines. The new method doesn’t require root and notifies all applications listening for power events.

Systemd Method

Starting with Ubuntu 16.04, systemctl call must be used (See Suspend command in Ubuntu 16.04)

systemctl suspend

and

systemctl hibernate

New Method

See the answer here on this page from Adam Paetznick regarding the use of dbus. Ideally you would create a ~/bin/suspend shortcut/script that makes the use of this action easy.

For use over ssh, you should modify policykit rules as outlined by Peter V. Mørch

Old Method

According to the Ubuntu Forum you can use the following commands:

pmi action suspend

and

pmi action hibernate

This requires that you install the powermanagement-interface package (not tested).

sudo apt-get install powermanagement-interface

I have also found the commands sudo pm-suspend and sudo pm-hibernate to work on my netbook.