Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I'm trying to run a Python script on startup on a Raspberry Pi. I know that this can be accomplished by adding to various files. I plan to add to bashrc (worked previously, on similar attempts), but I am confused on the difference between the ".bashrc" file that is in my home directory and the "etc/bash.bashrc" file. Can someone please explain the difference?

Note: If the answer changes based on OS flavor- I'm running Occidentalis (a variant on Wheezy).

share|improve this question

migrated from Apr 23 '13 at 8:12

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

I think this is more of a power-user or sysadmin question than a programming question, so you'll probably get better answers at one of the other SE sites (I'm guessing superuser). – abarnert Apr 23 '13 at 0:57
up vote 3 down vote accepted

First, bashrc files are not run at startup, they're run at the start of every interactive bash shell session. If you never log in, they'll never get run. If you log in and out repeatedly (or, more realistically, ssh in 20 times), they'll get run over and over.

Second, in general, everything in /etc/ is system-wide, while everything in your home directory is just for you. So, /etc/bashrc is run for any account's interactive bash shells, while ~/.bashrc is run only for yours. (Of course on a single-user machine, none of the other accounts are actual people who will ever run an interactive bash shell, so the distinction may not seem that important.)

Anyway, if you really want to run at startup, the right way is generally to create an init script (although in some cases you may be able to get away with using rc.local or other mechanisms). See this doc for a basic primer on init scripts, and some Debian specifics.

share|improve this answer

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.