Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
how to run shell (bash) script automatically at startup?

Hey there,

I need to do some more homework ;-) The question is where do I have to place a script so it runs on every startup ?


share|improve this question

migrated from stackoverflow.com Jul 18 '10 at 20:17

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

marked as duplicate by Doug Harris, random Jul 20 '10 at 2: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.

On startup or when you login? –  Felix Jul 18 '10 at 19:23
You shouldn't just post homework questions and expect to get them answered. It'll just mean you don't remember when you're tested. At least tell us what you already think the answer is –  Gareth Jul 18 '10 at 19:51
If this is truly a homework question, the only answer I'll give is man bash. Learning how to find the answers is a good skill, but relying on a site like superuser.com is a secondary choice after doing your own research first. –  Doug Harris Jul 20 '10 at 2:01

1 Answer 1

From Startup files:

startup files

These files contain the aliases and environmental variables made available to Bash running as a user shell and to all Bash scripts invoked after system initialization.

/etc/profile systemwide defaults, mostly setting the environment (all Bourne-type shells, not just Bash 1)

/etc/bashrc systemwide functions and aliases for Bash

$HOME/.bash_profile user-specific Bash environmental default settings, found in each user's home directory (the local counterpart to /etc/profile)

$HOME/.bashrc user-specific Bash init file, found in each user's home directory (the local counterpart to /etc/bashrc). Only interactive shells and user scripts read this file. See Appendix G for a sample .bashrc file.

share|improve this answer
I've also seen $HOME/.bash_rc used (in Mac OS X I think). –  Marnix A. van Ammers Jul 19 '10 at 2:32
Most likely Timothy was referring to startup files for bash when he logs in, but it's possible he meant startup files for when the system starts up. So, in that case I thought I'd add: In most unixes, there are startup scripts in /etc/init.d/ with links in /etc/rc.d/* or /etc/rc*.d/ pointing to those startup scripts. In some unixes a script called rc.local exists somewhere (try "locate rc.local" to find it) and this file will automatically be run when the system starts up. –  Marnix A. van Ammers Jul 19 '10 at 2:40