How to Execute Scripts and Commands at Login in Ubuntu 25.10

Ubuntu 25.10 has discontinued the Startup Applications utility, but users can still configure applications, scripts, and commands to launch at login, though the process has become a bit more complex. The GNOME desktop’s integrated settings now allow users to easily autostart applications through a toggle found in the Settings > Applications menu. However, this convenient method only works for applications and does not support user-defined commands or scripts, which may be needed for custom tasks.

To set up auto-start for scripts and commands, you can create a .desktop file within the ~/.config/autostart directory. If the directory doesn’t exist, you can create it manually.

Steps to Autostart Commands in Ubuntu 25.10

Step 1: Locate or Create the Autostart Directory

  1. Open your home folder and check if the ~/.config/autostart directory is present.
  2. If not, create it by navigating to the .config directory, right-clicking, and choosing to create a new folder named autostart (all lowercase).

You can also use the terminal to create this directory quickly:

mkdir -p ~/.config/autostart

Step 2: Create Your .desktop File

Using a text editor, create a new .desktop file for each command or script you wish to autostart. Here’s a template to follow:

[Desktop Entry]Type=ApplicationExec=$HOME/scripts/your_script.shHidden=falseName=Your Script NameComment=Description of what the script does

Ensure the Exec line contains the appropriate command or script path. Here are some examples:

  • For a direct script:
    Exec=$HOME/scripts/backup.sh

  • For simple commands:
    Exec=update-manager --install-all

  • For more complex commands with delays:
    Exec=sh -c "sleep 5; $HOME/scripts/myscript.sh"

If the command needs to be run in a terminal window, add Terminal=true to the .desktop file.

Step 3: Save and Test

  1. Save your file with a .desktop extension in the autostart folder.
  2. Log out and back in to check if the command or script starts as expected.

Alternatives

For advanced users, using systemd User Services can provide more control over startup behaviors. However, for most users, .desktop files offer a simpler and manageable method to autostart custom scripts and commands.

To modify or delete an autostart, you can change Hidden=false to =true in the .desktop file or remove the file from ~/.config/autostart/.


Posted

in

, ,

by

Tags: