Stephen Brennan
brennan.io · Personal blog · on HN since 2016
Stephen Brennan writes programming tutorials and essays on C, shells, system calls, Meson, Git, and operating systems.
What HN saysHN commenters cite his tutorial on writing a shell in C as a great, simple read. They also point to his Meson post and call his educational approach valuable.
37HN people shared it
5linked it in comments
56stories submitted
2.3Kstory points
6 months agolast shared
2016people per year2026
Most-shared posts
- 1Write a Shell in C (2015)11 people · 874 points · first shared 2016 · 80 comments on HN
- 2Tutorial – Write a System Call10 people · 276 points · first shared 2016 · 16 comments on HN
- 3Embracing Modularity with Meson4 people · 36 points · first shared 2020 · 5 comments on HN
- 4When it comes to Git history, less is more3 people · 257 points · first shared 2021 · 122 comments on HN
- 5Development of a Developer (2017)3 people · 8 points · first shared 2017 · discussion on HN
- 6Why You Should Hire Computer Science Majors3 people · 4 points · first shared 2016 · discussion on HN
- 7Linked Lists Are Still Hard2 people · 184 points · first shared 2017 · 133 comments on HN
- 8Stack Overflow Users Rejoice as Pattern Matching Is Added to Python2 people · 129 points · first shared 2021 · 20 comments on HN
- 9My experience being blocked by Google Safe Browsing2 people · 6 points · first shared 2022 · discussion on HN
- 10You Don't Learn (2016)2 people · 2 points · first shared 2024 · discussion on HN
- 11Implementing simple cooperative threads in C1 people · 304 points · first shared 2020 · 86 comments on HN
- 12Visualizing Gzip Compression with Python1 people · 79 points · first shared 2020 · 6 comments on HN
- 13Fare Hacking on BART1 people · 46 points · first shared 2016 · 51 comments on HN
- 14Space Cadet Pinball on Linux1 people · 34 points · first shared 2026 · 3 comments on HN
- 15The Windows 10 Installer Dystopia1 people · 6 points · first shared 2020 · 2 comments on HN
What HN people wrote when they linked it
woodrowbarlow · 2017-09-01
stephen brennan wrote a great article [1] on how to write a shell in C. it's a little more simply than DAS' implementation, but it's a fantastic read.
[1] https://brennan.io/2015/01/16/write-a-shell-in-c/
aninteger · 2024-03-08
I've always preferred Stephen Brennan's approach mentioned here: https://brennan.io/2020/05/08/meson/
This is the approach I take with my C and C++ projects, although I've swapped meson out for CMake. I still have my CMake projects generate pkg-config files as well so that I don't force CMake on any consuming projects (just because I suffered with CMake doesn't mean you have to, although you can as well :))
warriorkitty · 2016-11-20
I decided to read ep1[0] too and I saw a picture "use all the memory". I don't know if it's funnier that I checked if you have an "alt" HTML tag or that you actually wrote the text from the picture. People with alt tags are MVPs. :)
[0] - https://brennan.io/2016/10/13/kernel-dev-ep1/
vmateixeira · 2016-07-15
Hope this can help [1]. Otherwise, if you just want an API wrapped up with python [2].
[1] http://brennan.io/2015/01/16/write-a-shell-in-c/
[2] http://www.ibm.com/developerworks/aix/library/au-pythocli/
FRex · 2018-04-24
It's very educational to dig into stuff that everyone takes for granted or even try implement your own version that does similar things (at a smaller scale and with less features, performance and security of course, just for educational purposes, not to serve as a real replacement).
E.g. writing your own shell sounds hard but you can do it in an hour (of course it'd be very bare compared to even ash), I once did it during a very casual C class while trying to impress the teacher. He even joked it was self hosting when he has seen the end result (as in - I didn't need other shells anymore and could use vim and gcc from my shell so I could use my shell to work on my shell). I wanted to put that into tutorial at some point but there already exists one[0] (that blog seems quite tinker-y actually, it has implementing own Linux sys call too, which is also surprisingly easy to do and I did it for a class at one point too[1]).
Going knee deep into this stuff also completely dispels the magic that language and system runtimes, filesystems, file formats, linkers, shells, standard commands (e.g. ls, I had to reimplement it once as a homework) or whatever have, or even better - it's still magic to most people and you're the wizard now! It's also very accomplishing to do something so unique in an hour or two (although to me due to my C and C++ bias at some point making a pastebin clone in an hour in PHP or Python became an unique experience).
Even JIT (which sounds scary due to V8,…