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.

I frequently need to start several programs that I use every time I start my computer. How can I make it so that whenever I login the program is automatically launched?

share|improve this question
    
I presume Menu > Preferences > Startup Applications doesn't suit your needs? –  theTuxRacer Mar 18 '11 at 15:43
2  
@Kaustubh - it does. But I like generic questions rather than the same question asked multiple times with slightly different programs :) –  Marco Ceppi Mar 18 '11 at 15:45
add comment

8 Answers 8

up vote 35 down vote accepted

To make a program start with Ubuntu:

  • If you're using Unity, search for the program Startup Applications.

  • If you're using Ubuntu Classic, it's under Start Menu > Preferences > Startup Applications.


To make Ubuntu remember your running applications on shutdown:

  1. Open a terminal, and run gconf-editor.

  2. Navigate to /apps/gnome-session/options.enter image description here

  3. Enable the option: auto_save_session.

(NOTE: this may slow system boot, and has not been throughly tested.)

share|improve this answer
    
i did that but like i remember in 10.10 it has a button that said click here to remember all applications open to be start up automatically (or something like that) –  Kevin Maghuyop Apr 30 '11 at 19:00
    
Please see my edited post. –  Alan Apr 30 '11 at 19:09
    
okay..so its being fixed right? or being "discussed" –  Kevin Maghuyop Apr 30 '11 at 19:26
    
That post is from February when Natty was being tested. There is no other information that goes along with it, but I would assume they are still trying to fix it. –  Alan Apr 30 '11 at 19:32
    
okay ...thank you for informing this information –  Kevin Maghuyop Apr 30 '11 at 20:05
show 6 more comments

In 14.04 (Unity):

Dash > Startup applications > Add 

How to find out commands of all installed applications (in one action) (simple script):

#!/usr/bin/python3
import os
dtfile_list = os.listdir("/usr/share/applications")
for item in dtfile_list:
    if item.endswith(".desktop"):
        with open("/usr/share/applications/"+item) as commandlist_source:
            searchlines = commandlist_source.readlines()
        try:
            command_data = ([
                line for line in searchlines if line.startswith("Name=")
                ][0].replace("Name=", "").replace("\n", ""),
                            [
                line for line in searchlines if line.startswith("Exec=")
                ][0].replace("Exec=", "").replace("\n", ""))
            print(command_data[0], "||", command_data[1])
        except Exception:
            pass

Copy the text, paste it into an empty textfile, save it somewhere as list_commands.py, cd into its directory, run it by:

python3 list_commands.py

It produces a list like (application name / command):

User Accounts || unity-control-center user-accounts
Cheese || cheese
Ubuntu Software Center || /usr/bin/software-center %u
Mines || gnome-mines
Shotwell || shotwell %U
Synaptic Package Manager || synaptic
Time and Date || time-admin

etc, etc
share|improve this answer
add comment

12.04 (Unity)

We can add applications to the "Startup Applications" by opening the menu entry on the top panel right side:

enter image description here

This will open a window where we can see all installed applications that will run on startup. Tick or untick the applications there or choose "Add" to add a new application:

enter image description here

If we know the command to run the application just enter it here in the "Command" line. We may also add an optional "Comment" here.

If we do not know the command we can choose to "Browse..." our file system for installed applications. Many default applications are found e.g. in /usr/share/application:

enter image description here

Select an application to add to autostart.

Command line or programmatical approach for 12.04

Similar to what the GUI solution above does we can manually add a .desktop file to ~/.config/autostart. The content of this file may be as follows:

[Desktop Entry]
Type=Application
Exec=</path/to/binary or command to execute>
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=<Name_to_be_displayed>
Comment=<optional comment>

Note that in a vanilla installation of 12.04 the directory ~/.config/autostart does not exist. We need to create it before we can access it programmatically.

share|improve this answer
    
Thanks for the programmatic approach, that's exactly what I was looking for. –  Jacobo de Vera Aug 27 '13 at 11:37
add comment

In 11.04, you press the powerbutton (rightmost on the upper panel) and select System settings. You'll find Startup Applications under Personal preferences. It's the same dialog that we had in earlier versions of Ubuntu.

share|improve this answer
add comment

Another, possibly simpler, option would be to go to menu System/Preferences/Startup applications, then choose the "Options" tab and tick "Automatically remember running applications when logging out"

Startup Applications Preferences

This will start up any applications you have running when you log out.

share|improve this answer
    
+1 but this needs to be handled with care. If one of the apps just running is buggy or crashes the X-Server you may end up with a bad to handle no-fun system (I had that once). –  Takkat Mar 19 '11 at 19:08
    
Yeah, I admit - that's why I stopped using it too. There is always "gnome-failsafe" session, I suppose, but I couldn't figure out how to recover my crashed session. That was years ago though. Hard to believe it would happen these days. –  Scaine Mar 19 '11 at 19:45
    
How to get this Options tab in Ubuntu 12.04? there is only one Startup Programs one –  yetanothercoder Aug 10 '12 at 9:26
    
12.04 has removed the "automatically remember" option I show above. You have to search Dash for "Startup Applications" then manually add the entries you want. –  Scaine Aug 12 '12 at 22:45
add comment

User defined sessions for applications to start after login

An alternative way to automatically start applications after login is to define a user defined session. This has the advantage to use different sessions for different task, each with different applications loaded.

For this purpose we create a custom.desktop file as root in /usr/share/xsessions with the following content (for GNOME/GDM):

[Desktop Entry]
Name=Marco's Crowded Session
Comment=Custom ~/.xsession script
Exec=/home/username/.xsession
X-Ubuntu-Gettext-Domain=gdm

Use any fancy name for your session and replace username by your name of course.

This will run the script .xsession in the HOME directory at login where we can put in any appplications we need to start after login.

The script needs to be named as defined in the .desktop file, that is ~/.xsession in the example given, needs to be made executable and may have a content similar to this:

#! /bin/bash

my-important-app [options] &
second-app [options] &
[...]                       # add other applications
gnome-session [options]

Options for gnome-session may be omitted to load the default session. Give e.g. --session=classic-gnome as option to run Classic GNOME Desktop in 11.04.

Next time we login we will have the choice to start a "Marco's Crowded Session" with all applications from the script running in addition to applications from the gnome-session (or any other desktop manager you chose to start here).

Starting other desktop managers

To start another installed desktop manager replace the last line from the ~/.xsession script with the following:

  • gnome-session --session=ubuntu for standard desktop (with Unity in 11.04).
  • gnome-session --session=classic-gnome for classic GNOME desktop.
  • startkde for KDE desktop manager.
  • startxfce4 for XFCE, or when running Xubuntu.
share|improve this answer
    
Very cool. Not sure I'd use it personally, but very cool. –  Scaine Mar 19 '11 at 13:09
    
I like it clicks imaginary like button –  RolandiXor Mar 19 '11 at 18:49
add comment

i guess that you can add the command in System --> Preferences --> app Start

then click add, put a name somthing like "Firefox start" the command name part click

"examine" and look for executable file of the program that you need start at login...restart

hope this help you!!!

regards!!!

share|improve this answer
add comment

If you are using the GNOME Desktop Environment, then this is rather simple to accomplish.

  • Go to System>Preferences>Startup Applications,

menu screenshot

  • Now you can either add an application by clicking add,

enter image description here

  • And adding the application/script you want to run on startup,

enter image description here

  • Or you can add an application by dragging the launcher you wish to add from the Application menu to the Startup Applications screen.
share|improve this answer
    
For Gnome Shell, you have to open it though Ctrl + F2 and typing gnome-session-properties –  Balder Oct 28 '13 at 22:14
add comment

protected by Community Sep 21 '11 at 15:46

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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