There are several threads which unsuccessfully seek a command line method to hibernate or suspend in Ubuntu, WITHOUT requiring root or sudo access. After a bit of digging, I've come up with the answer.
This is tested on Ubuntu 8.04 (Hardy) with a Dell Inspiron 1520 laptop. I would appreciate feedback from users of other systems.
To suspend-to-RAM (aka sleep):
To suspend-to-disk (aka hibernate):Code:pmi action suspend
If you want to lock the Gnome session first (ie. require a password on resumption), then issue the following command before pmi:Code:pmi action hibernate
For example, you can use these commands to create a button (launcher) on a Gnome panel (taskbar) that instantly locks the screen and goes into sleep mode:Code:gnome-screensaver-command --lock
Right-click panel, Add to panel, Custom application launcher, Add, Name: Sleep , Command: gnome-screensaver-command --lock ; pmi action suspend