Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 stackoverflow.com 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 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 comment

3 Answers 3

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
add comment

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

share|improve this answer
add comment

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
add comment