Adding or removing a command in Linux

So where do you add an instruction you want to run on startup in Linux? Well, it depends on when in the bootup-startup process you want it to run. If you want it to run just as it is initialising the gui (X11) then the best way is to create a file called ‘autostart’ in your /home/username directory. Then go to the script that controls the startup script for X11 and add the autostart file to that script.

As of 2016 you will find the startup script at:


Go to the bottom of this file and insert the instruction:


This instruction will now cause the lx sesstion to run the startup  script in your home directory. Now go to your home directory and create a file called autostart. In this script add the command line you would like to run. For example if you want to run a http server at startup, you can add the line:

@python SimpleHttpServer 80

in that scrip.

Now, whenever you want to add a startup script to your system you don’t need to go hunting around the internet finding all those misleading tips—rather the startup script is right there in your home directory.

Leave a Reply

Your email address will not be published. Required fields are marked *