In this article, we cover how to autostart an application in Ubuntu. What we try to achieve here is that, we have got a preferred application which we intend to start it at every boot. Though, there are numerous GUI applications which can help us autostart an application. But, we won’t use any of those.
If we have to start an application at every boot then manual intervention is certainly something which we don’t prefer. It’s better if we could make it run at every boot on its own. That way, we save our precious time. And, a regular should be able to get it done. No superuser privileges required.
Note: Before we move ahead, we would like to add here that – what we discuss below has been tested on XFCE, LXDE, CINNAMON and MATE Desktop Environment of Ubuntu 22.04 release. It should work for other Desktop Environments as well.
Autostart an application in Ubuntu
Method I. All we need to do is, put Desktop entries of an application we want to autostart in the directory –
These Desktop entries can be found in the directory –
For instance, if we want Google Chrome browser to autostart then –
cp /usr/share/applications/google-chrome.desktop /home/$USER/.config/autostart/
Method II. Alternately, we can create a Desktop entry in the directory itself for an application. Use a text-editor, we have used nano –
And, append the file with following text –
[Desktop Entry] Type=Application Name=Google Chrome Comment=Google Chrome Web Browser Exec=google-chrome-stable --incognito OnlyShowIn=LXDE
And, save the file in the directory –
That is pretty much everything we have to do. The above code for Desktop Entry is self-explanatory. Just that, Exec would contain the application command. And, OnlyShowIn values are defined for various Desktop Environments as –
|Value for OnlyShowIn||Desktop Environment|
The above specified OnlyShowIn values are case-sensitive.
In conclusion, application autostart help us save time and bring in efficiency to the system.