F
Flowblok
blog.flowblok.id.au · Personal blog · on HN since 2013
Flowblok is a developer's blog best known for a diagram and article explaining which shell startup scripts run in bash and other shells.
What HN saysCommenters link the shell startup diagram for explaining config files, though one calls it confusing for not explaining its seven arrow colors.
18HN people shared it
13linked it in comments
6stories submitted
83story points
3 years agolast shared
2013people per year2026
Most-shared posts
- 1Shell startup scripts14 people · 81 points · first shared 2013 · 9 comments on HN
- 2Shell startup actual.png4 people · first shared 2017
- 3Day 6 of Advent of Code in Hurl1 people · 2 points · first shared 2024 · discussion on HN
- 4Shell startup scripts.html>1 people · first shared 2013
- 5Shell startup.png1 people · first shared 2017
What HN people wrote when they linked it
eddyg · 2017-08-13
http://blog.flowblok.id.au/static/images/shell-startup-actual.png
"To read it, pick your shell, whether it's a login shell, whether it's interactive, and follow the same colour through the diagram. When the arrows split out to multiple files, it means that the shell will try to read each one in turn (working left to right), and will use the first one it can read."
Note that what the man pages say happens (as of 2013) is in this diagram:
http://blog.flowblok.id.au/static/images/shell-startup.png
maurycy · 2013-07-21
http://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
Edit: Not that I recommend the resource, just fixed the link for you.
tzs · 2018-01-06
As given in the article, it's also the most annoying bash diagram ever...it needs an explanation of what the 7 different colors of arrows mean. All that was given is:
> It shows which scripts bash decides to run from the top, based on decisions made about the context bash is running in (which decides the colour to follow).
> So if you are in a local (non-remote), non-login, interactive shell (eg when you run bash itself from the command line), you are on the ‘green’ line [...]
With a bit of Googling I believe I found the origin of that diagram:
https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
The author there explains how the colors work:
> Fortunately, I’ve read the man pages for you, and drawn a pretty diagram. To read it, pick your shell, whether it's a login shell, whether it's interactive, and follow the same colour through the diagram. When the arrows split out to multiple files, it means that the shell will try to read each one in turn (working left to right), and will use the first one it can read
em500 · 2023-06-25
I wonder if there is any mainstream program with a more convoluted configuration scheme than bash? Just when think you understand the various invocations of .profile, .bash_profile, .bashrc in login/non-login/interactive/non-interactive modes in home and/or /etc after digesting an article with flowcharts[1], you realize that any invocation can execute arbitrary code from any location, and different distributions (not to mention, macOS, WSL, git-for-Windows, etc) all source different stuff in their default configs (like executing .bashrc in .profile).
[1] https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
arminiusreturns · 2020-10-24
Interesting on the docker angle. Sometimes seeing the flow visually can help people:
https://blog.flowblok.id.au/static/images/shell-startup-actual.png
https://i.stack.imgur.com/6LQgh.png
jlgaddis · 2020-10-24
The former image is from a blog post entitled "Shell Startup Scripts" [0] which I've just submitted [1] separately because it's so much more informative (it's been posted to HN previously but never really provoked much discussion).
That blog post was my primary reference after zshall(5) when I decided to blow away the years of cruft I'd built up, start over, and rewrite my (Zsh) shell init files from scratch -- and I've been amazed at how much more organized and manageable it all is since then!
Prior to switching to Zsh, I had gotten to the point of just dumping everything in one file and making sure it was sourced (by bash) in all instances.
--
[0]: https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html?hn=2020…
[1]: https://news.ycombinator.com/item?id=24881944
wadkar · 2020-04-10
The blog where this image was first published in 2013:
https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
Note that there is recent edit to the blog post saying "it depends on your OS packaging".
The SO question where an answer refers to this image and has some relevant discussion: https://unix.stackexchange.com/questions/493173/changing-histsize-in-u…
s_gourichon · 2019-10-17
There's a graph (generated by graphviz from text description) that shows the flow and files involved for bash, sh and zsh. Yes, it's insane.
https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
sirn · 2019-09-01
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-actual.png
[2]: https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
mlinksva · 2018-01-06
re 9) I feel better about always feeling at least slightly confused about what files are being sourced.
The graph included seems to originate from https://blog.flowblok.id.au/2013-02/shell-startup-scripts.html
arca_vorago · 2017-05-10
Here is another one that is useful, but it's always good when someone does the digging and figuring out for themselves.
http://blog.flowblok.id.au/static/images/shell-startup-actual.png
gue5t · 2013-07-21
See <http://blog.flowblok.id.au/2013-02/shell-startup-scripts.html>, the most comprehensive overview I've encountered to date.
Pwnguinz · 2013-07-21
It has to do with the fact that the GP put the URL in < > and HN assumed the trailing > was part of the URL. Just remove the trailing > in the URL and it'll work.
Alternatively reproduced here without the '>':
http://blog.flowblok.id.au/2013-02/shell-startup-scripts.html