How to Auto Start an App in Your Linux (Various Distros Support)

Want to automatically run an application, script or command on startup of your Linux Desktop? Here’s how to do the trick either via graphical configuration tool or by editing config file.

By following this tutorial, your specified apps will start automatically after login. If you want to run something even before user login, please create a systemd service instead.

And, this tutorial is tested in various Linux distributions, including Ubuntu, Manjaro, Fedora, Debian, Linux Mint, Ubuntu MATE, Kubuntu, XUbuntu, Linux Lite, Pop! OS, Zorin OS, and LUbuntu.

Add Startup Applications in Linux Desktop

The configuration varies depend on your Desktop Environments. If your system is not included in this post, try the last one to edit config file.

For GNOME Desktop (Ubuntu, Fedora, etc.)

GNOME Desktop, defaults in Ubuntu, Fedora Workstation, optional in Debian, Arch and Manjaro has the “Gnome Tweaks” tool that can do the job.

Firstly, search for and install Gnome Tweaks from Ubuntu Software, Gnome Software, Pamac or your system package manager.

Install Gnome Tweaks in case you don’t have it

Then, launch the tool and navigate to “Startup Applications” in left pane. Finally, click on the “+” button will open up the dialog, which allows to search or browse through applications.

Once you selected the desired app, click on ‘Add’ button and done!

Add auto-start app in GNOME

For Ubuntu, Linux Mint, Ubuntu MATE, Zorin OS

Ubuntu has a specific tool to manage startup applications. As well, Linux Mint, Ubuntu MATE, and Zorin OS use either same or similar tools to do the job.

First, search for and open “Startup Applications” either from ‘Activities’ overview screen or start menu depend on your system.

In the pop-up dialog, you can simply click “Add” or “+” to start adding a startup program.

Sadly, this dialog is not so friendly to beginners in Ubuntu. User has to know the executable command for launching certain app. Or, browse in “Other Locations -> Computer -> usr -> bin” directory.

However, it’s a bit more powerful than the function in Gnome Tweaks. User can add a time delay via sleep command with how many seconds to wait until launching, or run a personal script.

  • sh -c “sleep 10; firefox” – automatically launch Firefox with 10 seconds delay
Add Startup Program in Ubuntu

For Linux Mint, the utility is more friendly as “+” button asks to either run custom command or choose an application. And, there’s an option to set the time delay.

For KDE Plasma Desktop (KUbuntu, Manjaro KDE, Ubuntu Studio, etc.)

The KDE Plasma desktop is more customizable than most other Linux desktops. Not only for running app on startup, it also makes easy to run script on logout.

Firstly, search for and open “System Settings” from start menu. Then, navigate to “Startup and Shutdown -> Autostart“.

Then click on “+ Add…” button in the bottom, to either add application, login script or logout script.

Add auto-start app/script or logout script in KDE

After adding an app or script, user can click the “Properties” icon for each app/script to open dialog to edit the permissions, command, etc.

For Xfce4 Desktop (Linux Lite, XUbuntu, etc.)

The lightweight Xfce4 desktop has a “Session and Startup” dialog allows to manage startup applications.

User can open it either by searching from start menu or by running xfce4-session-settings in terminal. When it opens, navigate to “Application Autostart” tab, and click on “+” button to create:

  • Name: something as you want.
  • Description: optional
  • Command: browse in Other Locations > Computer > usr > bin, or type manually.
  • Trigger: select run app or command at login, logout, shutdown, restart, suspend, hibernate or switch user.
Manage auto start applications in Xfce4

For LXQt Desktop (LUbuntu, etc.)

For LUbuntu, Debian, Fedora, etc. with LXQt desktop, open start menu and navigate to “Preferences > LXQt Settings > Session Settings“.

Or run lxqt-config-session in terminal to open the tool. Then, navigate to “Autostart” tab in the left, and finally click “Add” button to add auto-start applications.

NOTE: Here, app under “Global Autostart” starts in all sessions (if any), and those under “LXQt Autostart” will start only in LXQt session.

Manually edit config file (Universal)

Auto-start apps, commands, or scripts usually have corresponding .desktop files either in “/etc/xdg/autostart” (for all users) or “.config/autostart” for current user only.

In case non of the previous steps work for your Linux PC, try to manually create .desktop file, by opening “Files”, pressing Ctrl+H to display hidden folders, and navigating to .config -> autostart (create if not exist).

Then create and write in following lines into the file:

[Desktop Entry]
Type=Application
Exec=your-command-here
Hidden=false
Name=whatever-name
Comment=Optional

User can add optional lines in the .desktop files, such as:

  • OnlyShowIn= – to only show it in specified sessions. The value can be: GNOME, KDE, Xfce, LXQt.
  • Terminal=false – whether needs to be run in a terminal or not
  • X-GNOME-Autostart-Delay=5 – delay app startup in seconds. For Ubuntu, Fedora, Linux Mint Cinnamon, & other Linux with GNOME.
  • Hidden = true – Disable the app auto-start without removing the file.
As mentioned, non-GNOME desktop can use Exec=sh -c "sleep 10; command-here" to add a delay before automatic launching the app.

Summary

In general, each Linux desktop environment has a graphical utility to manage auto startup applications. Though, user can manually create .desktop files under either ‘.config/autostart‘ or ‘/etc/xdg/autostart‘ directory that works in most Linux Distros.

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.