How to Run a Program at Startup Using Ubuntu

Use Startup Application Preferences to configure programs to run at boot time

Launch applications when Ubuntu starts using a straightforward graphical tool.

The Startup Application Preferences tool is a part of all currently supported Ubuntu distributions. The procedures in this article demonstrate the tool in Ubuntu 19.10.

Startup Application Preferences

startup application preferences window in ubuntu

The tool used to get applications to start when Ubuntu loads is called Startup Application Preferences. Press the Super key on the keyboard to bring up the Ubuntu Dash and search for Startup. Click the utility from the list.

On most keyboard, the Super key maps to the left Windows key.

When the tool opens, you'll see that some items will already be listed as startup applications, and you should not alter these.

The interface is fairly straightforward. There are just three options: Add, Remove, and Edit.

Adding Programs as Startup Applications

add startup program

To add a program at startup click the Add button. A new window appears with three fields:

  • Name
  • Command
  • Comment

Enter the name of something that you will recognize in the Name field. For example, to launch Rhythmbox at startup, type Rhythmbox or Audio Player.

In the Comment field, provide a good description of what is to be loaded to explain the purpose of the application and why it runs at startup.

The Command field is the most involved part of this process. This field identifies the command to execute, and it can be a program name or the name of the script. For example, to get Rhythmbox to run at startup type Rhythmbox.

If you don't know the correct name of the program you want to run, or you don't know the path for it, click the Browse button and find it on your system.

After you have entered all the details, click OK. The application joins the startup list.

Finding Commands for Applications

Adding Rhythmbox as an application at startup is easy because it is the same as the name of the program. However, if you want something like Chrome to run at startup, then entering Chrome as the command will not work. 

The Browse button isn't particularly very useful on its own because, unless you know where a program is installed, it can be hard to find.

As a quick tip, most applications are installed in one of the following locations:

  • /usr/bin
  • /usr/sbin
  • /usr/local/bin
  • /usr/local/sbin

If you know the name of the program you wish to run, open a command prompt by pressing CTRL+ALT+T and entering the following command:

which google-chrome

The which utility returns the path to the application. For example, the above command will return the following:

/usr/bin/google-chrome

It may not be immediately obvious that to run Chrome you have to use google-chrome. An alternative way to find out how a command is run is to physically open the application by selecting it from the Dash. Simply press the Super key and search for the application you wish to load at startup and click the icon for that application.

Now open a terminal window and type the following:

top -c

A list of the running applications displays. Look for the application. The best thing about this approach is that it provides a list of switches that you might wish to include as well.

If you've installed it, the htop command works for this purpose, too, and is a bit less cluttered.

Copy the path from the command and paste it into the Command field on the Startup Applications screen.

Editing Commands

To tweak a command because it doesn't run properly, on the Startup Applications Preferences screen click the Edit button.

The screen that appears is the same as the one for the Add New Startup Application screen. The name, command, and comment fields will already be populated. 

Amend the details as required and then click OK.

Preventing Applications From Running at Startup

To remove an application that is set to run at startup, select the line within the Startup Application Preferences screen and click the Remove button. It's best not to remove default items that you didn't add, to reduce the risk of destabilizing your desktop environment.

In some cases, it isn't a good idea to execute the command at startup but to run a script that executes the command. A good example is the Conky application, which displays system information on your screen. In this case, you won't want Conky to launch until the display has fully loaded. A sleep command embedded in the script prevents Conky from starting too soon.