How to run applications at startup on Ubuntu 18.04?

Startup applications are the programs that are launched automatically when Ubuntu boots up. Sometimes you want to make an application start after you log in to the system, like for instancea chat app or fan controller app, etc..
It could be also the case when the number of applications or services at startup becomes high that the system starts to slow down or show signs of sluggishness. In such situations, you may want to remove some of these automatically started programs in order to free up the system resources.
In this short article, you will learn how to execute a program at startup and how to prevent applications from launching automatically once the system boots up.

Startup applications management

Ubuntu has already a tool to manage Startup Applications .In order to open it, go to Dash and look up the word “Start ”as shown below :

Once the shortcut appears, Now, click on it. This will bring up the window below :

Ubuntu startup applications 

To add a new application, simply hit the Add button and insert in the command field your program name in order to run the application. To know which command corresponds to your desired program, refer to the following section.

Ubuntu 18.04 run script on startup

Read: How to list, start and stop services at boot time in Linux Ubuntu/Debian

How to find the command to run an application?

To find the correct command that calls your application proceed as follows :

1 – Open the folder /usr/share/applications :

Right click on your desired application icon and select Properties :

This will bring up a small popup in which you can find the required command :

Once you know the command, copy it and go back again to the prompt window of the previous section, .i.e.

Ubuntu startup applications command line

Now in the Command field, paste the command value. You may want also to enter a name and a description. Finally, click on on Add button. Now in the next boot up, your selected application will be automatically launched at boot up.

Remove startup applications in Ubuntu

To remove a program from startup applications preferences, select it and then click on Remove button. :

Ubuntu startup applications

The program will not launch automatically at each start-up. Note that this will not uninstall the program.

Read: How to shut down, restart, suspend and hibernate Linux

Delaying a program launch at boot

To delay the launch of your chosen application proceed as follows :

1 In case your application already starts at boot, open up the startup application preferences window

2 Select the application

3 Hit the edit button

4 Put the cursor on the command field and add ‘sleep n’ right at the start of the command. This will delay the launch of the program by n seconds. See example below :

Ubuntu startup script

Now save and quit. This will take effect at the next boot.

Hidden startup programs display

To see the services that are launched at startup, open up a terminal and run the command below:

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

This is a sed command that will find and replace the ‘NoDisplay=false’ attribute with ‘NoDisplay=true’ in all the applications that have autostart enabled.
Once the command above is completed, open the Startup Applications Preferences and you should be able to see many more applications as shown below :

Startup services

Conclusion

This tutorial has demonstrated how to control startup applications in Ubuntu. Questions are always welcomed.


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

ziad nahdy

Ziad Nahdy, fan of open source and programming languages. He is a technical writer, blogger and Linux enthusiast. He loves to read and help others with their problems. He is addicted to open source software but he also loves other technology related subjects.

This Post Has 4 Comments

  1. Hi Ziad,
    I tried to use the sleep command on Ubuntu in the startup app as is listed in many places including yours. On 20.04 this did not work. I created a bash script and called the script from the startup app and that worked. Also added X-Gnome-Autostart-Delay=5 to the program name.desktop file created by the startup app and this worked too. I’ve seen older comments on forums where sleep did not work on previous versions of Ubuntu. Not sure whats going on here. Sleep worked fine on CLI.

    1. Hi Gerald,
      screen has been included since 16.04 : sleep

  2. That is nice if you have a graphic interface but I have now to work by ssh. can we do this with ssh. and what if I need to start my application after another process has been started ? how can I control that by ssh ?

Leave a Reply

Close Menu