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
Open a terminal window.
Navigate to the
/etc/xdg/autostartdirectory by running the following command:
- Create a new .desktop file named
test.desktopby 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
Y, and then
Ensure that the
autostart.shfile located at
/home/linaro/autostart.shhas 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.