Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Is there any way to add an application/script to the Linux startup so every time the system is on it executes [i'm looking for some automated way, user should not add this by cron job or something like that].
Yeah you are right, i want to create a little cute virus :) and also want to know if it is possible.

share|improve this question

migrated from stackoverflow.com Aug 29 '11 at 2:08

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

See also this SO answer: Run automatically program on startup under linux ubuntu – Abhishek Gupta Jul 19 '12 at 14:36
up vote 9 down vote accepted

Something like Cron?

Note the @reboot entry

This is the most flexible approach, and the one most like Windows' "Scheduled Tasks" (better actually).

share|improve this answer
is it possible to add a job in CRON without user's intention ? – Sourav Aug 16 '11 at 15:01
yes. just write to /etc/cron.d, or call crontab from your program without them knowing. – awoodland Aug 16 '11 at 15:07
What do you mean? If you mean manually add one programatically, then yes. Crontabs are just text files. – kevlar1818 Aug 16 '11 at 15:07

Yes, one simple way to add entries to /etc/rc.local

share|improve this answer
adding entry in the file will start the program each time ? – Sourav Aug 16 '11 at 15:01
Each time you reboot, yes. If you want regularly scheduled jobs (every day, hour, week, or any odd combination) then the cron scheduler is your friend. – Dirk Eddelbuettel Aug 16 '11 at 15:02

Apart from system-level startup scripts your desktop environment might have its own way of auto-running programs. The folder .config/autostart is supposed to be a desktop-neutral way of defining autorun entries. /etc/xdg/autostart is for system-wide configuration. Details about the spec at http://developer.gnome.org/autostart-spec/.

For LXDE autostart entries can also be set in ~/.config/lxsession/LXDE/autostart.

It is a bit different if you need to run your scripts after the network is up and running. In that case you should check the special post-connect scripts that can be defined for your network manager. Both NetworkManager and wicd have their own ways of specifying post-connect autorun entries. If the network is configured via ifupdown, then post-up scripts can be placed in the /etc/network/if-up.d/ folder.

share|improve this answer

Write your own script for /etc/init.d

share|improve this answer

Each distribution uses each own bootstrap technique, so need to look at docs for your distro. /etc/rc.local is a place where you can put some automated scripts, but it is really outdated. Now most of linux based systems uses runlevels or systemd bootstraping, so most of autostarted jobs could be fine-grade controlled.

share|improve this answer

I found my answer here: http://stackoverflow.com/questions/7221757/run-automatically-program-on-startup-under-linux-ubuntu I was able to create a file / script to turn off my trackpad while I in my Linux Ubuntu 12.10 session.

share|improve this answer
Glad you found a solution, could you include a summary of the steps in your answer, just so this answer is a more useful than just a link. Thanks! – slm Apr 24 '13 at 4:15
Was looking for a way to automate and turn off my trackpad at startup. The command I entered in Terminal was 'sudo modprobe -r psmouse' This would turn off the trackpad while in the current session. I wanted to automate this at boot. I did some research and wrote a script by modifying the file /etc/rc.local, adding 'sudo modprobe -r psmouse. Then issuing the following commands from Terminal: 'sudo mv /filename /etc/init.d/' 'sudo chmod +x /etc/init.d/filename' 'sudo update-rc.d filename defaults' Now the touchpad is off at startup. – CatGuyTX Apr 25 '13 at 5:57
  1. Search for Startup applications using home button
  2. Click Add
  3. Enter a name to call the application (any name will do)
  4. In the Startup command box enter the command
  5. Click OK (You should see your new command in the list)
  6. Click Close

Test by restarting or logging out and back in.

Source: https://help.ubuntu.com/community/AddingProgramToSessionStartup

share|improve this answer
Please don't post link-only answers; include enough detail to enable people to understand your answer without leaving the page. – jasonwryan Jun 6 '14 at 9:55
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Anthon Jun 6 '14 at 9:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.