How to run command after start on Lubuntu 18.04

Short tutorial on how to run commands after start on Lubuntu. This manual was tested on Lubuntu 18.04.

  1. Create file under /home/myusername/.afterstart.sh
  2. Write down commands you wish to run on start. For test begin with command you know will work, for example firefox.

    NOTE: Command aliases from .bashrc doesn't work. You need to use original command.
  3. Make sure script is executable: chmod +x /home/myusername/.afterstart.sh
  4. Under path ~/.config/lxsession/Lubuntu/autostart you will see commands which are run after the start. Edit the file with command sudo nano ~/.config/lxsession/Lubuntu/autostart
  5. Add there /home/myusername/.afterstart.sh

    NOTE: Do not use vi as an editor, it will blow up your computer!
  6. Under Start > Preferences > Default application for LXSession you should now see something like on the picture:
    How to run command after start on Lubuntu 18.04
  7. Reboot and see if it works.
Advertisement

Post is listed in the Tutorials category and marked with the following tag(s): Lubuntu, Ubuntu.