KDE will launch programs configured in the configuration files within the Autostart directories whenever you start your KDE session. You have the option to launch normal programs or to launch shell scripts, be it Bash, zsh, or other shell script types. You can also configure the scripts to execute during session logout.

If you need your script or program to launch during other stages of Linux startup, you can look into crontab or systemd.

You can create these configuration files manually, or you can use the provided Autostart tool from KDE's System Settings.

Steps to configure autostart program for KDE:

  1. Launch System Settings from the launcher.
  2. Go to Startup and Shutdown from the sidebar menu.
  3. Click on Autostart on the sidebar.
  4. Click on Add button at the bottom of the screen.

  5. Click on Add Application to add program to launch during KDE startup.
  6. Filter and choose application from the list and click OK.
  7. Click on the Add button again to now start adding shell script.
  8. Click on the Add Login Script button to add shell script to automaically start during KDE startup.
  9. Browse script using the file picker and click Open.

    By default it is set to create a symlink / softlink to your actual shell script.

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

  10. Launch terminal.
  11. Check content of generated Autostart desktop file.
  12. Check generated softlink in Autostart script directory.