Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I make an application automatically start when I have logged in?

share|improve this question

13 Answers 13

up vote 172 down vote accepted

12.10 and later

  • Open the Dash and search for "Startup Applications"

    enter image description here

11.10 - 12.04 LTS

  • Click on the cog wheel on the top right corner of your screen and choose Startup Applications, or type "Startup..." in the Dash.

    enter image description here

  • Now click on Add and give in the command to run the application. This can be found in Main Menu if installed (see below) or as shown in this question.

    enter image description here


11.04

  • Click the button on the top-right corner and select System Settings

    enter image description here

  • Now click on startup applications.

    enter image description here

  • proceed as shown above


Using Main Menu (alacarte Install alacarte)

  • Firstly open the program 'Main Menu' (type Menu in the Dash)

    enter image description here

  • Now select the program which you want to add to startup and click on properties .

    enter image description here

  • Now note the command for that program .

    enter image description here


Non GUI approach

Advanced users may want to put a .desktop file in ~/.config/autostart to run applications after a user login. This may have following content:

[Desktop Entry]
Type=Application
Name=<Name of application as displayed>
Exec=<command to execute>
Icon=<full path to icon>
Comment=<optinal comments>
X-GNOME-Autostart-enabled=true
share|improve this answer
    
in 12.04 you can run "Startup Aplications" from the dash the same way like in 12.10 –  jutky Jan 2 '13 at 23:20
    
@jutky: the difference is, that we dont have it any more in the me-menu from the cogwheel in 12.10. –  Takkat Jan 2 '13 at 23:36
1  
useful the "Non GUI approach" part, I was searching that folder! –  Pisu Jan 7 '13 at 17:50
    
@Pisu: on a vanilla installation you may have to create this directory first to be able to use it. –  Takkat Jan 7 '13 at 18:22
5  
The Start-up Applications Preferences dialogue can be brought up from ALT+F2 gnome-session-properties if you can't find it in menus (e.g. in Gnome Shell) –  mtdevans Jan 28 '13 at 22:59

For 11.04 and newer see here: How to start applications at startup automatically in 11.04?

For older versions: If the program you wish to run on startup is in the Applications menu, you can drag-and-drop it into the Startup Applications window to add it to the list.

enter image description here

share|improve this answer

Launch Startup applications from Dash

enter image description here

Click on Startup Applications

enter image description here

And then click on add

enter image description here

Type the name of the program, browse to the command, and then click add.

Addition: Here is a sample that I use to autostart Guake - the Gnome version of Yakuake:

Put this in the 'command' box.

sh -c "sleep 120s; guake"

This starts guake automatically, but waits 2 mins before doing so. You can change the 120 to whatever you wish.

Edit:

For 14.04:

Type Startup in Dash, and run Startup Application form there

enter image description here

And then just follow the rest of the steps.

share|improve this answer
    
In Ubuntu 14.04, I don't see those options in the system menu in the upper right. –  user29020 Sep 25 at 7:39
1  
In 14.04 type Startup in dash, and you can run it from there. Look at the addition in the answer. Thanks –  Mitch Sep 25 at 13:02

Both Unity and Xfce4 have GUI programs that allow you to control startup applications.

For Unity:

enter image description here

enter image description here

For Xfce4 Startup tool is available in Settings > Session and Startup

enter image description here Image courtesy of Xubuntu Geek xubuntugeek

If the GUI is not what you want, and you want is more advance control, then you can put .desktop files in the ~/.config/autostart/ directory for Xfce4, and a .desktop file in ~/.config/autostart for Unity to run applications after a user login.

Check this question to get more help on creating .desktop files:

Also note if you want a startup application to start only in XFCE, but not in Unity, you have to put the line OnlyShowIn=XFCE in the .desktop file. It is OnlyShowIn=Unity for a Unity only application.

share|improve this answer
    
From your answer what I get is that for both you put .desktop file in ~/.config/autostart/ –  Eduard Florinescu Aug 30 '12 at 7:37
    
Please if you know by heart what would be that GUI program, for Unity it is Startup Applications(easy to search), for xfce ? –  Eduard Florinescu Aug 30 '12 at 7:38

You can use GNOME Startup Application. enter image description here

Click the Add button and then add the full command to open the application you want. If you don't know the path of the command you can do

which name_of_commmand

share|improve this answer

You can use the feature to "Remember Currently Running Applications" in the "System/Preferences/Startup Applications" preferences window. Which (when enabled) will "remember" all the programs that you are using and will re-open them after a reboot or when starting the system for the first time in a day.

This is great when you don't have enough time to make notes of what were you doing the last time and you wish an application to open if it was running the last time.

If you wish to remove an application from this feature simply close it and go to this function and press the "Remember Currently Running Application" in order to refresh the list of the programs that will be opened the next time.

A screenshot is placed here in order to illustrate.

enter image description here

share|improve this answer
    
The only thing I do not like about this one is that your/my wireless is slower to come up than my browser is in loading when it was active. Every tab needs to be reloaded after wireless picks up. –  Rinzwind May 8 '11 at 17:17
    
Good point. That's why I don't save that preference with the browser open :) Docky is owning the control for my browser with an icon on it. But yours is a good point! Thank you. –  Geppettvs D'Constanzo May 9 '11 at 20:50

Also to put a BATCH FILE into start up applications to run after user login.... type at the command line in start up applications in the field Command:

gnome-terminal  -e  "/batch-path/batch-name.sh" 
  • gnome-terminal: open the terminal after user login with current user privileges
  • -e: set the terminal to execute the batch file
  • "/batch-path/batch-name.sh": is the batch full path and full name

Remember than the file batch permissions to set the flag "Allow executing file as a program" to ON.

share|improve this answer

type as startup applications in your unity dash and it will list you that application and click it to open . after opening that you can add your application there .

share|improve this answer

Ubuntu 13.10 with UNITY Instructions

To do this with a command that requires sudo is a bit tricky.

In my case, I wanted to disable the PSMOUSE driver using the command sudo rmmod psmouse to prevent a mouse click problem that randomly manifests itself. See http://xpapad.wordpress.com/2009/09/09/dealing-with-mouse-and-touchpad-freezes-in-linux/ for more info on this problem. I got tired of entering it on every boot.

On my install, the ~/.config folder did not have an autostart sub-folder, so I created one. This enabled my Startup Applications Perferences settings to be saved.

In order to toggle visibility of hidden startup applications, you can use the following commands.

To show them :

sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop

To hide them :

sudo sed -i 's/NoDisplay=false/NoDisplay=true/g' /etc/xdg/autostart/*.desktop

Configure your command as per above posts in the Startup Applications Perferences window.

Name:    Fix Mouse
Command: sudo rmmod psmouse
Comment: Fix Mouse

Then you have to edit the /etc/sudoers file using sudo visudo. Add a line that contains the following info:

username ALL=(ALL) NOPASSWD: /sbin/rmmod

You must enter this line below the line which starts with %admin. I added my line to the end of the file. It is IMPORTANT to use sudo visudo to edit this file as making a mistake will prevent you from being able to do any sudo commands at all. If that happens, boot in recovery mode and undo your edits, then try using sudo visudo.

Note: Initially I tried using a bash script to run my the command indirectly, but this didn't work. I had to put sudo rmmod psmouse directly in the Edit Startup Program window.

share|improve this answer

Alt+F2, then gnome-help ghelp:user-guide?gosstartsession-2.

Click Run, wait a sec, and then follow the directions.

share|improve this answer
    
cool I know the part to add but not the commands... so do I google them? or should I hit alt+f2 then put the name of the program... if it finds it, I'll say run in terminal... to display the command? –  user11383 Feb 24 '11 at 4:43
    
@Bob, which application do you want to run on start up? –  Oxwivi Feb 24 '11 at 5:35

For Ubuntu 12.04,

1) Launch Startup Application from the top right menu

enter image description here

2) Without clicking on Add, open Dash and type the application you want running at startup e.g. Skype

enter image description here

3) Drag the application to the Startup application window. If Dash windows is too big that you can't drag your app outside, use the restore window button (shown in the previous image) at the top left corner. Final list looks like this:

http://imgur.com/G60wbOJ

share|improve this answer

You might want to start it from a CLI via:

$ gnome-session-properties

(just in case you're not running GNOME ;))

share|improve this answer

Take a loot @ $XDG_CONFIG_DIRS/autostart directory like

usr@myLinuxTower: ~$ echo $XDG_CONFIG_DIRS/autostart
/etc/xdg/xdg-kde-plasma:/usr/share/upstart/xdg:/etc/xdg/autostart

which says there is 3 directories in this example, take a look @ it and for example, I liked to prune the nautilus entry

sudo rm /etc/xdg/autostart/nautilus-autostart.desktop

otherwise if you can add it, create a Desktop entry file like touch /etc/xdg/autostart/my-shell-autostart.desktop

[Desktop Entry]
Name=foo
Terminal=false
Exec=/path/shell.sh
Type=Application
Icon=/path/icon.png
Categories=Utility;
share|improve this answer

Your Answer

 
discard

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.