
Run Commands, the 'rc' in '.bashrc' - rspivak
https://en.wikipedia.org/wiki/Run_commands
======
IMMUNISE
The history of /usr and /home are pretty amusing too:

'When the operating system grew too big to fit on the first RK05 disk pack
(their root filesystem) they let it leak into the second one, which is where
all the user home directories lived (which is why the mount was called /usr).
They replicated all the OS directories under there (/bin, /sbin, /lib,
/tmp...) and wrote files to those new directories because their original disk
was out of space. When they got a third disk, they mounted it on /home and
relocated all the user directories to there so the OS could consume all the
space on both disks and grow to THREE WHOLE MEGABYTES (ooooh!).' \-
[http://lists.busybox.net/pipermail/busybox/2010-December/074...](http://lists.busybox.net/pipermail/busybox/2010-December/074114.html)

~~~
runn1ng
I found it funny that random decisions from 60s, 70s, 80s still have
repercussions on how we use computers today, because backwards compatibility
beats cleanliness every time.

Be right back, solving some Windows backslash and CRLF issues.

~~~
jhanschoo
Interestingly, some distros have undone/are undoing the usr split, fedora
around 2012 and Debian still ongoing, see
[https://wiki.debian.org/UsrMerge](https://wiki.debian.org/UsrMerge) and its
associated links

~~~
flukus
Why are they going from /bin to /usr/bin instead of /usr/bin to /bin ? I would
have thought they could flatten things out.

~~~
jhanschoo
A goal of Fedora was to have a "snapshottable" /usr that includes as much as
possible (all?) of the generic OS files. That is, multiple machines running
the same OS can have a shared /usr, and everything machine-specific in the
other dirs.

See
[https://fedoraproject.org/wiki/Features/UsrMove#Why_don.E2.8...](https://fedoraproject.org/wiki/Features/UsrMove#Why_don.E2.80.99t_you_move_all_.2Fusr_contents_to_.2F_and_forget_about_.2Fusr.3F)

------
aidos
More interestingly, I only recently learned that you can add a ~/.ssh/rc to
run commands on every ssh login. Are there other common useful rc locations
people are aware of?

~~~
jeremyjh
Can anyone give an example of a command I'd want to run on every .ssh login,
but not put into my .zshrc/.bashrc on that machine?

~~~
syncsynchalt
As an example: I'd love to run `set -o vi` on every ec2-user login, but the
machines tend to be ephemeral and this command might not be wanted by other
users, so I don't add it to /etc/profile or /etc/bashrc.

~~~
jeremyjh
Why wouldn't you put that in ~/.bashrc ?

~~~
syncsynchalt
The ec2-user is shared by all users who might login; our EC2 hosts usually
only last a few minutes/hours and are only accessed during debugging or
extraordinary circumstances.

~~~
jeremyjh
The .ssh/rc file goes on the server though, so you’d still have that problem.

------
weinzierl
So _' run commands'_ is the historically correct interpretation.

For me, I've heard it explained as _' run configuration'_ many years ago and
that is the explanation that stuck because _rc_ is in essence used for config
files no matter if they run commands or not. Others have found different
expansions, which are probably equally obvious for them. The ones I stumbled
upon by a quick search [1,2,3,4]:

    
    
        run commands
    
        run control
    
        run configuration
    
        runtime configuration
    
        resource control
    

Maybe there are more.

[1] [https://unix.stackexchange.com/questions/3467/what-does-
rc-i...](https://unix.stackexchange.com/questions/3467/what-does-rc-in-bashrc-
stand-for/3469#3469)

[2] [https://superuser.com/questions/144339/vimrc-screenrc-
bashrc...](https://superuser.com/questions/144339/vimrc-screenrc-bashrc-kshrc-
etc-what-does-the-rc-mean)

[3] [https://askubuntu.com/questions/23482/what-does-rc-in-
bashrc...](https://askubuntu.com/questions/23482/what-does-rc-in-bashrc-
nanorc-stand-for)

[4]
[http://www.catb.org/~esr/writings/taoup/html/ch10s03.html](http://www.catb.org/~esr/writings/taoup/html/ch10s03.html)

~~~
Sharlin
Certainly the other expansions are backronyms, invented by people wondering
what the "rc" stands for.

------
frereubu
There's a little bit of history in there too though, which I appreciated. The
fact that the title of the linked article on Wikipedia is "Run Commands" could
make the HN title seem clickbaity, but I would never have clicked on something
that just said "Run Commands", and now I know something new.

~~~
phillco
Wikipedia could also be safely considered as "not a clickbait site".

~~~
spodek
Oh yeah? This Wikipedia page is pure clickbait:
[https://en.wikipedia.org/wiki/Clickbait](https://en.wikipedia.org/wiki/Clickbait)

~~~
cerberusss
Comes with a pretty amazing example as well: "7 Clickbait Advertisements You
Won't Believe".

------
curtis
OK, now can somebody explain to me the difference between _.bashrc_ and
_.bash_profile_?

~~~
sirn
They're part of a complicated initialization process that can only be answered
with this beautiful diagram.[1][2]

[1]: [https://blog.flowblok.id.au/static/images/shell-startup-
actu...](https://blog.flowblok.id.au/static/images/shell-startup-actual.png)

[2]: [https://blog.flowblok.id.au/2013-02/shell-startup-
scripts.ht...](https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html)

~~~
al_form2000
Which gets it apparently wrong, as bash executes the *profile stuff on
interactive login shells also.

------
budhajeewa
Interestingly, in a `readme.md` that I had to write[1] yesterday, I had to
refer to this file, and I used the term "rc file".

I wondered what "rc" actually meant. It's interesting because I found the
answer today on HN. So random and unexpected .

Anyway, I wonder whether if I referred to it as the "Run Commands File", would
the people recognize what I meant.

\---

1\. [https://github.com/a2way-com/template-docker-
laravel/blob/55...](https://github.com/a2way-com/template-docker-
laravel/blob/55f95489d359c85370f61ca7d06b0570cd8ffca4/readme.md)

------
neom
Spurred me to find out that the ht in .htaccess is Hypertext

------
biztos
I spent the last 20 years thinking it was for “resource” — and now I can’t
even remember why I thought that.

~~~
thope
I thought that too, for me it's due to Windows resource files having `.rc`
extension. how mind works

[https://docs.microsoft.com/en-
us/windows/win32/menurc/about-...](https://docs.microsoft.com/en-
us/windows/win32/menurc/about-resource-files)

------
k__
Run commands is funny since many modern tools use ...RC files which usually
don't include direct commands, but declarative configuration.

------
satyanash
I always thought it was 'runtime configuration'.. as opposed to compile-time
configuration.

~~~
airstrike
I always thought of it as "remote controlled" even though it makes absolutely
zero sense

------
segfaultbuserr
Interesting. So basically, the "rc" in ".bashrc" has a meaning similar to the
"EXEC" in "AUTOEXEC.BAT".

------
loeg
Same as /etc/rc. (From which are obviously derived: /etc/rc.local, /etc/rc.d,
etc.)

FreeBSD init(8) still refers to it as "runcom":

[https://github.com/freebsd/freebsd/blob/90b1841/sbin/init/in...](https://github.com/freebsd/freebsd/blob/90b1841/sbin/init/init.c#L1041-L1054)

[https://github.com/freebsd/freebsd/blob/90b1841/sbin/init/pa...](https://github.com/freebsd/freebsd/blob/90b1841/sbin/init/pathnames.h#L42)

------
cmroanirgo
Ironically, .bashrc is not mentioned specifically at all in the Wikipedia
page, whereas .vimrc is.

> _It is used for any file that contains startup information for a command._

------
m4r35n357
Hmm, I thought it was "run control" . . . ;)

~~~
JasonFruit
I bet we all read the same Eric Raymond book/article.

~~~
rmwaite
ESR making things up authoritatively on the spot - no way.

------
benj111
I like how it was termed a fossil when it was added to Unix.

Now we seem to be flooded with them. TTY, terminal, core dump, floppy disk
save icon.

------
MisterTea
Interestingly the Plan 9 shell is called rc, written by Tom Duff (see Duff's
Device). This has at times lead to some confusion on my part when working
between unix and plan 9. Syntax is similar to bash.

------
cat199
to note the:

    
    
        rc in Unix
    

mentioned by K&R in the article likely refers to '/etc/rc', which was a shell
script run by init in research Unix (and still BSD, but not SysV)

~~~
cat199
see also:

    
    
        https://www.freebsd.org/cgi/man.cgi?query=init&sektion=8&apropos=0&manpath=Unix+Seventh+Edition
    

for 'then', and:

    
    
        https://www.freebsd.org/cgi/man.cgi?query=rc&sektion=8&apropos=0&manpath=FreeBSD+12.0-RELEASE+and+Ports
        https://www.freebsd.org/cgi/man.cgi?query=rc&sektion=8&apropos=0&manpath=OpenBSD+6.5
    

for (some of) 'now'.

------
alanbernstein
I thought it stood for "reconnect", now I can't figure out where I got that
idea.

------
ryanmarsh
I always thought rc files stood for ResourCe... in hindsight I realize how
doumb that was.

~~~
sanlyx
Not dumb at all; in fact, Win32 resource scripts[1] end with the ".rc"
extension

[1]: [https://docs.microsoft.com/en-
us/windows/win32/menurc/about-...](https://docs.microsoft.com/en-
us/windows/win32/menurc/about-resource-files)

~~~
nwellnhof
That's probably because they're named after the RC tool which stands for
"resource compiler".

------
rezeroed
Are there any distros with no interest in backward compatibility?

------
spraak
Somehow I interpreted and pronounced it as [r]esour[c]e

------
7ewis
>run commands

In case you didn't want to click the link.

~~~
nkkollaw
Saved my life.

~~~
HALtheWise
I know that it's a figure of speech, but I'm amused by trying to imagine
circumstances where needing to click a HN link could be a life threatening
situation.

~~~
benj111
Well hypothetically each mouse button has a certain finite number of clicks in
it before it breaks.

It could be in the future you'd need to click to send some crucial evidence to
stop you getting sentenced to death. It could be that this saved click is the
difference between the mouse failing or not on that occasion.

Of course the parent clicked send on their comment undoing the OPs good work.

This is all astoundingly improbable, but people buy lottery tickets each week.

~~~
NullPrefix
>Well hypothetically each mouse button has a certain finite number of clicks
in it before it breaks.

Omron switches (most commonly used) are rated from 1M to 20M clicks.

>It could be in the future you'd need to click to send some crucial evidence
to stop you getting sentenced to death. It could be that this saved click is
the difference between the mouse failing or not on that occasion.

Double click is the most common failure mode. When clicking, the switch
hesitates back and forth resulting in two mouse click events generated. This
could turn "drag and drop" into "launch program". Will leave the rest for your
imagination.

~~~
alluro2
"And thus The Last War begun and ended, in a fiery blaze of thermonuclear
detonations, initiated by a faulty $10 mouse, whose left switch has far
surpassed its expected rating, before failing at a critical probability
junction, along with whole of humanity."

------
gingabriska
I used to think bash RC is for Remote Control.

RC files were remote control files for m. I am pretty sure, I can't be the
only one who asssumed that.

~~~
Sebb767
Would be my first association as well, from things like RC cars and RC planes.
Doesn't really make sense in this context, though (but run commands sounds a
little bit of as well; something like configuration commands would've sounded
better in my opinion).

------
coding123
Wow, the HN title was the click bait and the article was just an article.

------
mindfulplay
I wish Hacker News had a section called Daily Factoids .. this particular
article is really interesting but isn't News.

