How to start a program automatically in Linux desktop

Last updated on September 13, 2020 by Dan Nanni

Sometimes you may want to launch a program automatically when you log in to your Linux desktop. Such start-up programs can conduct system-wide configuration (e.g., auto proxy) or user-specific desktop customization (e.g., via Conky), at the time you log in to your desktop.

Most Linux desktop environments have their own GUIs that allow users to configure user-specific auto-start programs or services.

In this tutorial, I will describe how to start a program automatically in various Linux desktop environments.

GNOME Desktop Environment

Run this command in a terminal to launch Startup Applications Preferences GUI.

$ gnome-session-properties

Click on Add button to configure a new startup application. Type in the name of the app, and the CLI command for the app, in Name and Command fields respectively. Type in optional description in Comment field.

Unity Desktop Environment

Type startup in Unity Dash. Once Startup Applications icon appears, click on it.

Once Startup Applications Preferences window opens up, enter Name, Command and Comment to configure a program to auto-start.

KDE Desktop Environment

First, open up System Settings window. You will find Startup and Shutdown icon under System Administration. Click on the icon.

You will be asked to choose an application to auto-start among a list of known applications. If your program is not listed, enter the name of the program in the top blank. If the program (e.g., CLI command) shall be run in a terminal, turn on the checkbox for Run in terminal. Click on OK button.

Next, you will be asked to enter the detail of the app, including name, command, and description.

After this, you will see that the program is configured to run on start-up. To configure additional start-up programs/scripts, you can click on Add Program or Add Script buttons in the right sidebar.

MATE Desktop Environment

On MATE desktop, go to ApplicationsPreferencesStartup Applications

You will see Startup Applications Preferences window. Click on Add button.

Enter the detail of a startup program: Name, Command and Comment.

Xfce Desktop Environment

Choose Settings Manager from Xfce desktop menus. In Settings window, click on Session and Startup icon.

Under Application Autostart tab, click on Add button at the bottom.

Enter the detail of a program to auto-start: Name, Command and Description.

LXDE Desktop Environment

To configure a start-up program on LXDE desktop environment, run the following commands in a terminal.

$ mkdir -p ~/.config/lxsession/Lubuntu/
$ touch ~/.config/lxsession/Lubuntu/autostart
$ leafpad autostart

Then add the following entry to the created autostart file:

@conky

Here, conky is the name of the CLI command that I want to auto-run upon log in.

Save and close.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean