You can configure applications or scripts to execute when logging in to your GNOME session. If you require your application or script to launch regardless of your desktop environment or even before you're logged in, you can use other methods such as systemd or crontab.

This method works for any Linux distributions as long as GNOME is the user's desktop environment. Some of the Linux distributions with GNOME as the default desktop environment are Ubuntu, and CentOS / Red Hat.

This method creates an autostart config file that GNOME uses to launch your application or script. It does not require the installation of third-party tools such as GNOME Tweaks.

Steps to configure autostart program for GNOME:

  1. Open GNOME Shell Activities.
  2. Search for and click on Startup Application Preferences.
  3. Click on the checkbox to uncheck or click on the Remove button to disable application from starting during GNOME startup.
  4. Click Add button to start adding program to run when GNOME starts.
  5. Enter a name and comment to identify the startup task.
  6. Manually enter the path to application binary or script along with necessary arguments, or click on the Browse button to locate the application or script.

    Make sure the user has execute permission on the script or application.
    Related: How to change file and folder permissions in Linux

  7. Click the Add button to finish adding the startup entry to GNOME.
  8. Click on the Close button if you're not adding other startup entries.
  9. Check the generated autostart file to confirm.
Discuss the article:

Comment anonymously. Login not required.