Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

What is the command line in bash to make a program run every time the system boots up?

share|improve this question

migrated from Feb 22 '11 at 20:37

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Seth, karel, Aditya, Avinash Raj, Florian Diesch Jan 6 '14 at 21:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Add an entry to your crontab to run @reboot:

@reboot command-to-run

Use crontab -e to edit your crontab.

From man 5 crontab:

Instead of the first five fields, one of eight special strings may appear:

         string         meaning
          ------         -------
          @reboot        Run once, at startup.
          @yearly        Run once a year, "0 0 1 1 *".
          @annually      (same as @yearly)
          @monthly       Run once a month, "0 0 1 * *".
          @weekly        Run once a week, "0 0 * * 0".
          @daily         Run once a day, "0 0 * * *".
          @midnight      (same as @daily)
          @hourly        Run once an hour, "0 * * * *".
share|improve this answer

Look at the /etc/rc*.d folders; they are used specifically for this type of thing.

share|improve this answer

I don't know about command line but, through the menu, you can go to "Session" under preferences and there you can specify the command-line commands that you would normally run manually.

This process won't work if what you try to run needs administrative privileges and, AFAIK, running apps with admin privileges on startup ain't precisely easy...

share|improve this answer