{"id":49762,"date":"2025-10-03T16:38:56","date_gmt":"2025-10-03T16:38:56","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=49762"},"modified":"2025-10-10T15:32:49","modified_gmt":"2025-10-10T15:32:49","slug":"run-command-script-automatically-at-login","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2025\/10\/run-command-script-automatically-at-login\/","title":{"rendered":"Run Custom Command or Script in Ubuntu 25.10 Automatically at Login"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-49763\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon-700x700.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startupapps-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>Ubuntu 25.10 no longer includes the &#8220;Startup Applications&#8221; utility! Here&#8217;s a beginner guide shows how to run apps, custom scripts or commands automatically at login through alternative methods.<\/p>\n<p>Ubuntu has a &#8220;Startup Applications&#8221; tool, allowing to easily add, remove, and edit items that run at user login. Due to upstream (meaning GNOME) changes, it has finally been dropped in 25.10.<\/p>\n<div id=\"attachment_49769\" style=\"width: 642px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startup-apps.webp\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-49769\" class=\"size-full wp-image-49769\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startup-apps.webp\" alt=\"\" width=\"632\" height=\"550\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startup-apps.webp 632w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/startup-apps-300x261.webp 300w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/a><p id=\"caption-attachment-49769\" class=\"wp-caption-text\">Startup Applications tool no longer available in 25.10<\/p><\/div>\n<p><!--more--><\/p>\n<p>The new way to auto start apps, is using GNOME Control Center (aka Settings) by navigating to &#8216;Apps&#8217; setting page, choose an app, and turn on the &#8220;Autostart&#8221; toggle switch. While, Gnome Tweaks also provides similar function to do the job.<\/p>\n<div id=\"attachment_49771\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup.webp\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-49771\" class=\"size-large wp-image-49771\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup-700x407.webp\" alt=\"\" width=\"610\" height=\"355\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup-700x407.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup-300x174.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup-768x446.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup-1536x893.webp 1536w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup-1320x767.webp 1320w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/g49-autostartup.webp 1715w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><p id=\"caption-attachment-49771\" class=\"wp-caption-text\">Autostart apps in Ubuntu 25.10 (GNOME 49)<\/p><\/div>\n<p><b>But, what if you want to auto-start app with custom options, or auto-run custom commands\/scripts at login?<\/b><\/p>\n<p>Here are 2 alternatives to do the job:<\/p>\n<ul>\n<li>Add startup app manually using <code>.desktop<\/code> configuration file.<\/li>\n<li>Use a third-party graphical configuration tool.<\/li>\n<\/ul>\n<h3>Option 1: Use .desktop configuration file<\/h3>\n<p>As you may know, all the app icons you see in Gnome app grid, dock, or other app launchers in most popular Linux distributions are handled by <code>.desktop<\/code> files under <code>\/usr\/share\/applications<\/code>, <code>.local\/share\/applications<\/code>, etc directories.<\/p>\n<p>Similarly, auto-start apps are handled by the <code>.desktop<\/code> files under either <code>\/etc\/xdg\/autostart<\/code> or <code>.config\/autostart<\/code> directories.<\/p>\n<p>And, when you turn on &#8220;Autostart&#8221; toggle switch for an application in Settings (Gnome Control Center), it will automatically create a file under <code>.config\/autostart<\/code> linked to the <code>.desktop<\/code> file for that app icon.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/auto-start-bysettings.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49772\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/auto-start-bysettings-700x413.webp\" alt=\"\" width=\"610\" height=\"360\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/auto-start-bysettings-700x413.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/auto-start-bysettings-300x177.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/auto-start-bysettings.webp 702w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>If you want to auto-run custom commands or scripts at login, then just create <code>.desktop<\/code> files in that directory with following steps.<\/p>\n<p><b>NOTE: for those hate Linux commands, open file manager and press <code>Ctrl+H<\/code> to show hidden files\/folders, then do following steps accordingly<\/b>.<\/p>\n<p><b>1. Create the directory.<\/b> The <code>~\/.config\/autostart<\/code> directory does not exist out-of-the-box. You may either enable an auto-start app via Settings to auto-create it, or open terminal (<b>Ctrl+Alt+T<\/b>) and run command below to create:<\/p>\n<pre>mkdir -p ~\/.config\/autostart<\/pre>\n<p><b>2. Create &amp; edit custom <code>.desktop<\/code> file.<\/b> Next, run command to create a <code>.desktop<\/code> file, &#8220;firefox-private.desktop&#8221; for example, and edit via <code>nano<\/code> command line text editor:<\/p>\n<pre>nano ~\/.config\/autostart\/firefox-private.desktop<\/pre>\n<p>When file opens, write following content and edit accordingly:<\/p>\n<pre>[Desktop Entry]\r\nType=Application\r\nExec=sh -c \"sleep 30; firefox --private-window https:\/\/www.google.com\"\r\nHidden=false\r\nName=Firefox Private Mode\r\nComment=Open google.com automatically in Firefox private window.<\/pre>\n<p>In the case, it will auto-launch Firefox in private mode and open Google.com automatically, with 30 seconds delay after login.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/autostart-firefox-private.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49773\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/autostart-firefox-private-700x543.webp\" alt=\"\" width=\"610\" height=\"473\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/autostart-firefox-private-700x543.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/autostart-firefox-private-300x233.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/autostart-firefox-private.webp 702w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>According what you want to run, you need to replace the command for &#8220;<b>Exec<\/b>&#8220;, and edit the &#8216;Name&#8217; and &#8216;Comment&#8217; as you want. For example, use:<\/p>\n<ul>\n<li><code>Exec=\/home\/ji\/Documents\/myscript<\/code> to run my script under user <i>Documents<\/i> directory.<\/li>\n<li><code>Exec=sh -c \"$HOME\/Documents\/myscript\"<\/code> to run the same script, but here &#8220;sh -c&#8221; command interpreter is required so it knows what is <code>$HOME<\/code>.<\/li>\n<li><code>Exec=update-manager --install-all<\/code> to auto-launch Software Updater and install all available updates.<\/li>\n<\/ul>\n<p><b>Tips:<\/b><\/p>\n<ul>\n<li>It&#8217;s better to first run the custom command or script in terminal to make sure it works.<\/li>\n<li>The X-GNOME-Autostart-Delay parameter does not work in Wayland, use <code>sleep<\/code> in command to add time delay in seconds.<\/li>\n<li>You may change <b>Hidden=false<\/b> to <b>Hidden=true<\/b> to disable that <code>.desktop<\/code> file, just like it&#8217;s deleted.<\/li>\n<li>Add <code>Terminal=true<\/code> if the command need to run in a terminal.<\/li>\n<li>For more about the desktop entry keys, see the doc in <a href=\"https:\/\/specifications.freedesktop.org\/desktop-entry-spec\/latest\/recognized-keys.html\" target=\"_blank\" rel=\"noopener\">freedesktop.org<\/a>.<\/li>\n<\/ul>\n<p>After created and edited the file, press <code>Ctrl+S<\/code> to save and <code>Ctrl+X<\/code> to exit, and verify if it works by logging out and back in.<\/p>\n<h3>Option 2: Use a third-party graphical application<\/h3>\n<p>To make things simple, there are few third-party graphical tools can do the job managing startup apps and scripts.<\/p>\n<p>As far as I know, the free open-source <a href=\"https:\/\/github.com\/flattool\/ignition\/\" target=\"_blank\" rel=\"noopener\">Ignition<\/a> tool is a good choice which provides a simple and modern user interface to add, remove, and modify startup entries.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49806\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition-700x332.webp\" alt=\"\" width=\"610\" height=\"289\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition-700x332.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition-300x142.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition-768x364.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition-1536x728.webp 1536w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition-1320x626.webp 1320w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/ignition.webp 1827w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>As you see in the screenshot, it provides a GTK4 and LibAdwaita interface, with ability to manage system startup entries (usually the <code>.desktop<\/code> files in <code>\/etc\/xdg\/autostart<\/code>) that works for all users.<\/p>\n<p>As well, it allows to add any installed apps (with custom options and time delay), custom command or script as auto-start items, by automatically creating <code>.desktop<\/code> files in user&#8217;s <code>.config\/autostart<\/code> directory. Meaning they work for current user only.<\/p>\n<h4>Install Ignition<\/h4>\n<p>Besides building from the source, the app is available to install in most Linux through <a href=\"https:\/\/flathub.org\/en\/apps\/io.github.flattool.Ignition\" target=\"_blank\">Flatpak package<\/a>, which runs in sandbox environment.<\/p>\n<p>For Debian, Ubuntu, and their based systems, run 2 commands below one by one to install the package:<\/p>\n<ul>\n<li>\nFirst, open terminal (Ctrl+Alt+T) and enable Flatpak support by installing the daemon package:<\/p>\n<pre>sudo apt install flatpak<\/pre>\n<\/li>\n<li>Next, install the app package by running command:\n<pre>flatpak install https:\/\/dl.flathub.org\/repo\/appstream\/io.github.flattool.Ignition.flatpakref<\/pre>\n<p><b>Tips<\/b>: You may run command as sudo (add <code>sudo<\/code> at beginning) to fix installing issue in Ubuntu 25.10.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/flatpak-ignition.webp\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/flatpak-ignition-700x591.webp\" alt=\"\" width=\"610\" height=\"515\" class=\"aligncenter size-large wp-image-49807\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/flatpak-ignition-700x591.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/flatpak-ignition-300x253.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/10\/flatpak-ignition.webp 758w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<\/ul>\n<p>After installed the package, either search for and launch it from Gnome Overview (log out and back in if app icon is not visible), or run command below to start from terminal:<\/p>\n<pre>flatpak run io.github.flattool.Ignition<\/pre>\n<h4>Uninstall Ignition<\/h4>\n<p>If the app does not work good for you, run the command below to uninstall it:<\/p>\n<pre>flatpak uninstall --delete-data io.github.flattool.Ignition<\/pre>\n<p>Also run <code>flatpak uninstall --unused<\/code> to remove useless runtime libraries. <\/p>\n<p>NOTE that uninstall the app won&#8217;t delete the auto-start entries created by it.<\/p>","protected":false},"excerpt":{"rendered":"<p>Ubuntu 25.10 no longer includes the &#8220;Startup Applications&#8221; utility! Here&#8217;s a beginner guide shows how to run apps, custom scripts or commands automatically at login through alternative methods. Ubuntu has a &#8220;Startup Applications&#8221; tool, allowing to easily add, remove, and edit items that run at user login. Due to upstream (meaning GNOME) changes, it has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":49763,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[770],"class_list":["post-49762","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-startup-applications"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/49762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=49762"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/49762\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/49763"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=49762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=49762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=49762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}