How does "Startup Applications" work?

  • /etc/rc.local

    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    

    Essentially the Multiuser Runlevel means when you boot up.

  • /etc/profile

    This file is invoked only for login shells because that is its specific purpose.

    /etc/profile, run by all Bourne-compatible shells (including bash and dash) when started as a login shell.

  • /home/$USER/.profile

    # ~/.profile: executed by the command interpreter for login shells.
    # This file is not read by bash if ~/.bash_profile or ~/.bash_login
    # exists.
    

    Both the ~/.bashrc and ~/.bash_profile are scripts that may be executed when bash is invoked. The ~/.bashrc file gets executed when you run bash using an interactive shell that is not a login shell. The ~/.bash_profile only gets executed during a login shell.

    Source

    So I think .profile gets executed if neither of those were (for whatever reason).

  • Finally, your GUI method is probably putting .desktop launchers in /home/$USER/.config/autostart

    This is run at user logon (GUI login only I think - so startx would but not tty login).

My pronouns are He / Him


Any desktop environment following the freedesktop specifications (aka XDG) should make use of autostarting applications on user login or whenever a removable medium was inserted.

For autostarting an application at user login the desktop environment looks for a .desktop file to execute the application specified there. This .desktop files usually are located in

$XDG_CONFIG_DIRS/autostart

But we can also have them in the following locations:

~/.config/autostart/ ## if $XDG_CONFIG_HOME is not set
etc/xdg/autostart/ ## if $XDG_CONFIG_DIRS is not set

In any case a .desktop file located in ~/.config/autostart is defined as being the most important file to be run thus overriding .desktop files in other locations.

Ubuntu fulfills this specification and users can add applications with a GUI approach to "Autostart Applications".

Application can be auto-started independent of the desktop from various other locations such as ~/.profile for the shell, in /etc/rc.local for running at system start or, more recently by using systemd.