Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have made a .sh (which works) to run a mono program. How do I make it run every time I login? (and display in a terminal, not just run in background) Ubuntu server 12.04 with Unity desktop.

share|improve this question
  • First make your script executable.
chmod +x /path/to/script
  • Open Startup Applications, from the cog menu present at the upper right corner.

Cog menu

  • Click on Add.

Startup Applications Dialog

  • Fill in all the details and click Add.

Add Startup Application Preferences

  • Logout and login back to check.
share|improve this answer

Yes you can start any script by navigating toSystem \ Preferences\ Sessions menu item and then just adding the command or the script you want to rin image

share|improve this answer
is this 12.04 ? it's unity in 12.04, not gnome 2 – Prasad RD May 6 '12 at 3:41
sorry, I meant unity. – jabelone May 6 '12 at 3:50
ok sorry for i took it for gnome. Well unity has its own preferences. The startup application in unity can be found at topbar as a drop-down menu option of power button, located before the shotdown options and all. – ashutosh May 6 '12 at 3:53
thanks, i have tried doing that to no avail. – jabelone May 6 '12 at 4:02

You could use $HOME/.bashrc It is parsed and run like a script, every time bash starts. Bash is the default shell for Ubuntu.

I have a script that saves every command line I've used, like this:

$ tail -2 $HOME/.bashrc
/usr/local/bin/ &
share|improve this answer
So I have to put my scirpt in .bashrc which is in /home? I tried this and it didn't work. – jabelone May 6 '12 at 4:10

Go into the Startup Applications dialog, click Add, give it a name and in Command put

gnome-terminal -e

You can check it works first by running gnome-terminal -e from a terminal (it should then open another terminal).

share|improve this answer

Put your script in a file (we call it and make in executable:

#put your script here
echo "Press enter to close"
read line

Then open /etc/rc.local file using a text editor:

sudo gedit /etc/rc.local

Finally add the following code in the rc.local just before "exit 0" command:

gnome-terminal -e "./dirtoyourscript/"

exit 0

Have a nice time.

share|improve this answer
I would believe, /etc/rc.local runs before X does (and thus, even before the login greeter); which means /etc/rc.local is not appropriate for doing things "after login". – sdaau May 4 '13 at 20:54

if you kown how to handle crontab , add this line :

@reboot gnome-terminal -e "./dirtoyourscript/"

if you don't know , execute the following commands to edit your crontab

export EDITOR
alias editor=$EDITOR
crontab -e
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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