Autostarting

This article links to various methods to launch scripts or applications automatically when some particular event is taking place, like system startup or shutdown, shell login or logout and so on.

Daemons

You can start your scripts or applications as daemons, see Daemon.

Systemd

systemd is the default init framework, replacing initscripts. The services which are started by systemd can be found in the subfolders of /etc/systemd/system/. Services can be enabled using the systemctl command. For more information about systemd and how to write autostart scripts for it, see at systemd. To autostart scripts for specific users, see systemd/User.

Runit

runit is a mature init system which offers process supervision, parallel startup, per-user service trees, granular cgroup manipulation, flexible dependency system, and boot times that don't incur the penalty of dbus. The root-level services are symlinks in /service with the actual service directories in /etc/sv. See the Runit page for more information.

Cron

Cron can be used to autostart non-GUI system setup tasks.

Shells

To autostart programs in console or upon login, you can use shell startup files/directories. Read the documentation for your shell, or its ArchWiki article, e.g. Bash#Configuration files or Zsh#Autostarting applications.

See also Wikipedia:Unix shell#Configuration files for shells.

/etc/profile

Upon login, all Bourne-compatible shells source /etc/profile, which in turn sources any readable *.sh files in /etc/profile.d/: these scripts do not require an interpreter directive, nor do they need to be executable. They are used to set up an environment and define application-specific settings.

Graphical

You can autostart programs automatically when you login into your Window manager or Desktop environment.

X session startup

See xinitrc and xprofile.

Desktop entries

Tango-two-arrows.png

Tango-two-arrows.png

This article or section is a candidate for merging with Desktop entries.

Notes: please use the second argument of the template to provide more detailed indications. (Discuss)

If you use an XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start *.desktop files found in the following directories:

  • System-wide: $XDG_CONFIG_DIRS/autostart/ (/etc/xdg/autostart/ by default)
  • GNOME also starts files found in /usr/share/gnome/autostart/
  • User-specific: $XDG_CONFIG_HOME/autostart/ (~/.config/autostart/ by default)

Users can override system-wide *.desktop files by copying them into the user-specific ~/.config/autostart/ folder.

For an explanation of the desktop file standard refer to Desktop Entry Specification. For a more specific description of directories used, Desktop Application Autostart Specification.

Note: This method is supported only by XDG-compliant desktop environments. Tools like dapper, dex, or fbautostart can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists. Use the existing mechanism to start the xdg compliant autostart tool.

GNOME, KDE, Xfce

GNOME, KDE and Xfce all have a dedicated GUI for autostart settings, see the respective articles.

LXDE

See LXDE#Autostart programs.

Fluxbox

See Fluxbox#Autostart programs.

Openbox

See Openbox#autostart.