I am running Ubuntu 11.04 and I want to be able to run a command like top so when I login it is running in a window.

I been trying many things for a while now and can't seem to get it to work

I added entries in the control panel under start up programs, but that didn't seem to work. I tried both having a script run, and actually typing the command, but neither was successful.

Thanks in advance :-)


In the "Startup Applications Preferences" window of the Ubuntu "Control Center", you need to do the following:

  • Click "Add"

This will open an "Add Startup Program" window with three input fields.

You can fill in a name and a comment, they speak for themselves. The command field is the important one. You could write this:

/usr/bin/gnome-terminal -e top

This line of text will be executed after X has started and right about when you see the "Ubuntu desktop" appearing. It will start a gnome-terminal and in it exectute the top command. The -e option causes this, because it stands for "execute the argument of this option inside the terminal".

If you like, you can also change the size and position of the terminal window. For that you use the --geometry option of the gnome-terminal command to specify this behavior.

See the man page (manual) of gnome-terminal for more details: http://manpages.ubuntu.com/manpages/hardy/man1/gnome-terminal.1.html

Or a nice introduction here: http://library.gnome.org/users/gnome-terminal/stable/

|improve this answer|||||

You may need to delay the execution of the script until X is properly up and running; something like this:

( sleep 5 && exec xterm -e top ) &

Make this executable and add it to your autostart applications.

You can experiment with reducing the amount of sleep to suit what you need.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.