Raspberry Pi

How to Run Application at Startup on Raspberry Pi

Although running applications on your Raspberry Pi system isn’t difficult for most users. However, there are some applications like Chromium browser and terminal that you should want to run whenever your system reboots. The reason is you will always need these types of applications to run on your system at the startup.

If you want to automate the tasks of running the applications at the system startup, follow this article to learn how you can do it on your Raspberry Pi system.

How to Run Applications at Startup on Raspberry Pi

There are different methods to run applications at the startup on Raspberry Pi and here we are discussing a few of them that you can easily do within seconds.

Method 1: Run Applications at Startup From xdg Directory

The “/etc/xdg” location includes most of the application’s files installed on your Linux system. It allows the users to autoStart an application whenever the system reboots.

To ensure an application runs on your desktop at the startup, you should need to create a file in the autostart directory within the “/etc/xdg” location using the following command:

$ sudo nano /etc/xdg/autostart/myapp.desktop

Inside the application file, you should add the following lines.

[Desktop Entry]

Exec=<name of the application>

You should need to replace the “name of the application” with the application name you want to run at the startup. To find the application name, select the Properties option by right click on the selected application.

You will find the application name in the “File:” option.

After successfully adding the application name, you can save the file using “CTRL+X” and reboot the device to launch the application at the startup.

Method 2: Run Applications at Startup By Creating an AutoStart File

By default, the Raspberry Pi uses the LXDE desktop environment that handles the GUI version of the Raspberry Pi system. You can utilize this desktop environment option and create an autostart file for running an application at the startup. To do this process, you must enter the Raspberry Pi configuration directory using the following command:

$ cd .config

Then create a directory “lxsession” and subdirectory “LXDE-pi” using the following command:

sudo mkdir -p lxsession/LXDE-pi

Now use the following command to create an autostart file in the location “/lxsession/LXDE-pi”.

$ sudo nano lxsession/LXDE-pi/autostart

Within this file, just add the following tags for the application:

@lxpanel --profile LXDE-pi

@pcmanfm --desktop --profile LXDE-pi

point-rpi


@<application_name>

In the above command, we are running multiple applications such as “Chromium Browser” and “Terminal”, so in the above command we have these applications’ names with @ sign.

Save the above file using “CTRL+X” after adding the application’s name and then reboot the device to make the changes.

Conclusion

Running applications at startup on Raspberry Pi isn’t difficult and you can do this process easily using any of the two methods mentioned in the above guidelines. Both these methods require you to create a file and add the application name inside the file. The application will automatically start once you reboot your system. You should ensure the file’s name must be correct and you can confirm it from the Properties option by right-clicking on the application you want to run at the startup.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.