What is the difference between /etc/rc.local and ~/.bashrc?

The difference is in when they are run and who they’re running as when run i.e. rc.local is run on a change of run level and it runs as root. bashrc is bash specific and run on a non login shell as a particular user.

You can find a good explanation of rc.local here

The script /etc/rc.local is for use by the system administrator. It is traditionally executed after all the normal system services are started, at the end of the process of switching to a multiuser runlevel. You might use it to start a custom service, for example a server that’s installed in /usr/local. Most installations don’t need /etc/rc.local, it’s provided for the minority of cases where it’s needed.

and you can find what you need about bashrc

man bash

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the –norc option. The –rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.

There’s more info on bashrc in this question…

https://superuser.com/questions/49289/what-is-the-bashrc-file

Leave a Comment