halt sudo halt -p
ubuntu 12.04 now requires halt and poweroff
sudo poweroff sudo reboot sudo shutdown -r now
First try and kill all the process on your current terminal. To do this, hold down the following keys -
ALT + SysReq + k
SysReq key means you need to Look for it on your PrtSc or Print Screen key. The k in this instance stands for Kill.
Now enter a series of keystrokes that will tell your computer to do some housekeeping before shutting down.
ALT + SysReq + r
This stands for Raw keyboard mode.
ALT + SysReq + s
This syncs the disk.
ALT + SysReq + e
This terminates all processes
ALT + SysReq + i
Kill processes that weren't terminated nicely.
ALT + SysReq + u
Remounts all filesystems as read only.
ALT + SysReq + b