With a simple indicator applet, you can display CPU and memory usage in real time on your Ubuntu upper panel (memory and CPU usage are expressed in percentage).
This applet is called System Monitor Indicator and can be easily installed on Ubunu 11.04 (Unity). The System Monitor Indicator applet is also pre-configured so you can run your own commands (in the Preferences section).
To install Indicator-Sysmonitor on Ubunu 11.04 (Unity), launch the terminal and issue these commands:
sudo add-apt-repository ppa:alexeftimie/ppa
sudo apt-get update
sudo apt-get install indicator-sysmonitor
For Ubuntu 10.04 / 10.10, you can download the deb package here. You can then run it via Applications >> Accessories >> System Monitor Indicator.