Debian 11 Autostart
To make a program or script run automatically when the Debian 11 operating system starts up, you can use the autostart feature. This can be accomplished by creating a .desktop file in the /etc/xdg/autostart
directory.
Steps
-
Open a terminal window.
-
Navigate to the
/etc/xdg/autostart
directory by running the following command:
cd /etc/xdg/autostart
- Create a new .desktop file named
test.desktop
by running the following command:
sudo nano test.desktop
- Copy and paste the following code into the file:
[Desktop Entry]
Type=Application
Exec=/home/linaro/autostart.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=MyScript
Comment=Runs MyScript script at system startup.
-
Save and exit the file by pressing
Ctrl+X
, thenY
, and thenEnter
. -
Ensure that the
autostart.sh
file located at/home/linaro/autostart.sh
has permissions to run by executing the following command:
chmod +x /home/linaro/autostart.sh
- Reboot the system to verify that the script runs automatically at startup.
Congratulations! Your script will now automatically run at system startup on Debian 11.