<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shinji Ito</title>
    <description>The latest articles on DEV Community by Shinji Ito (@shinjiito).</description>
    <link>https://dev.to/shinjiito</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4073653%2Fc647a92e-4706-4bf0-94da-8c3341a97b91.png</url>
      <title>DEV Community: Shinji Ito</title>
      <link>https://dev.to/shinjiito</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shinjiito"/>
    <language>en</language>
    <item>
      <title>Building a Unix Shell from First Principles in Rust</title>
      <dc:creator>Shinji Ito</dc:creator>
      <pubDate>Wed, 26 Aug 2026 14:41:49 +0000</pubDate>
      <link>https://dev.to/shinjiito/building-a-unix-shell-from-first-principles-in-rust-35ek</link>
      <guid>https://dev.to/shinjiito/building-a-unix-shell-from-first-principles-in-rust-35ek</guid>
      <description>&lt;p&gt;I’ve been working on a project called &lt;strong&gt;Whelk&lt;/strong&gt;, a Unix shell built from first principles in Rust.&lt;/p&gt;

&lt;p&gt;The goal wasn’t to build another Bash replacement.&lt;/p&gt;

&lt;p&gt;I wanted to understand what actually happens underneath a shell — from parsing a command line to creating processes, connecting pipes, handling signals, managing jobs, and interacting with the terminal.&lt;/p&gt;

&lt;p&gt;The project is intentionally small enough to understand, but deep enough to expose how Unix actually works.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Whelk currently covers quite a lot of the machinery involved in a real interactive shell:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Command parsing with a lexer and AST&lt;/li&gt;
&lt;li&gt;Quoting, escaping, and useful error locations&lt;/li&gt;
&lt;li&gt;Environment and variable expansion&lt;/li&gt;
&lt;li&gt;Input/output/error redirection&lt;/li&gt;
&lt;li&gt;Concurrent pipelines&lt;/li&gt;
&lt;li&gt;Process creation and waiting&lt;/li&gt;
&lt;li&gt;Signal handling&lt;/li&gt;
&lt;li&gt;Process groups&lt;/li&gt;
&lt;li&gt;Job control with &lt;code&gt;jobs&lt;/code&gt;, &lt;code&gt;fg&lt;/code&gt;, and &lt;code&gt;bg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Terminal mode management and resizing&lt;/li&gt;
&lt;li&gt;History and command completion&lt;/li&gt;
&lt;li&gt;An event loop using &lt;code&gt;epoll&lt;/code&gt; on Linux and &lt;code&gt;kqueue&lt;/code&gt; on BSD/macOS&lt;/li&gt;
&lt;li&gt;Benchmarks and allocation-oriented regression tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The project is split into relatively small Rust crates so that the boundaries between parsing, execution, processes, jobs, terminals, and events remain visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;The biggest lesson has been that systems programming is often about understanding boundaries.&lt;/p&gt;

&lt;p&gt;A shell looks simple from the outside:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command → process → output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But underneath, there are many moving parts.&lt;/p&gt;

&lt;p&gt;Pipelines involve multiple processes communicating through file descriptors.&lt;/p&gt;

&lt;p&gt;Job control requires understanding process groups and terminal ownership.&lt;/p&gt;

&lt;p&gt;Signals introduce asynchronous behavior.&lt;/p&gt;

&lt;p&gt;Terminal interaction requires changing terminal modes and restoring them correctly.&lt;/p&gt;

&lt;p&gt;Even something as simple as pressing &lt;code&gt;Ctrl-Z&lt;/code&gt; involves much more than detecting a key.&lt;/p&gt;

&lt;p&gt;Building these pieces myself forced me to understand the operating system rather than treating it as an abstraction that simply works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rust Made the Project Interesting
&lt;/h2&gt;

&lt;p&gt;Rust has been particularly useful for this kind of project.&lt;/p&gt;

&lt;p&gt;The shell inevitably has places where it needs to interact directly with operating-system primitives, including &lt;code&gt;fork&lt;/code&gt;, &lt;code&gt;exec&lt;/code&gt;, file descriptors, signals, and terminal operations.&lt;/p&gt;

&lt;p&gt;Those boundaries require &lt;code&gt;unsafe&lt;/code&gt; code, but I’ve tried to keep the unsafe parts concentrated in the process and OS-facing layer.&lt;/p&gt;

&lt;p&gt;That creates an interesting design constraint:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much of the system can remain safe Rust while still exposing low-level Unix behavior?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That question has influenced the architecture quite a bit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance Was Another Lesson
&lt;/h2&gt;

&lt;p&gt;I initially expected parsing and command processing to be the interesting performance problems.&lt;/p&gt;

&lt;p&gt;The benchmarks showed otherwise.&lt;/p&gt;

&lt;p&gt;For example, parsing a pipeline is around microseconds, while starting a process is hundreds of microseconds on the same benchmark setup.&lt;/p&gt;

&lt;p&gt;That changes how I think about optimization.&lt;/p&gt;

&lt;p&gt;If process creation dominates the cost, spending a huge amount of effort shaving a few nanoseconds from parsing isn't particularly meaningful.&lt;/p&gt;

&lt;p&gt;The benchmarks also uncovered a feature with a much larger cost than I expected — exactly the kind of thing that is easy to miss when you only optimize based on intuition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I’m Building It
&lt;/h2&gt;

&lt;p&gt;The main reason is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I want to understand the systems underneath the software I use every day.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;High-level abstractions are incredibly useful, but occasionally going one layer deeper is valuable.&lt;/p&gt;

&lt;p&gt;Building a shell forced me to learn about processes, file descriptors, signals, terminals, scheduling boundaries, event notification, and the Unix process model in a much more concrete way.&lt;/p&gt;

&lt;p&gt;And that's what I enjoy about projects like this.&lt;/p&gt;

&lt;p&gt;The final application isn't necessarily the most important result.&lt;/p&gt;

&lt;p&gt;The understanding you gain while building it is.&lt;/p&gt;

&lt;p&gt;Whelk is still evolving, and there are intentionally many things it doesn't try to implement. It's not intended to become a drop-in replacement for Bash.&lt;/p&gt;

&lt;p&gt;It's a learning project, an engineering experiment, and a way for me to make the operating system's process model visible through code.&lt;/p&gt;

&lt;p&gt;The source is available on GitHub:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/ferris007/whelk" rel="noopener noreferrer"&gt;https://github.com/ferris007/whelk&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>systems</category>
      <category>linux</category>
      <category>bash</category>
    </item>
    <item>
      <title>Why I Contribute to Open Source: Building Something Bigger Together</title>
      <dc:creator>Shinji Ito</dc:creator>
      <pubDate>Wed, 26 Aug 2026 14:38:32 +0000</pubDate>
      <link>https://dev.to/shinjiito/why-i-contribute-to-open-source-building-something-bigger-together-56g3</link>
      <guid>https://dev.to/shinjiito/why-i-contribute-to-open-source-building-something-bigger-together-56g3</guid>
      <description>&lt;p&gt;I don’t contribute to open source because I have nothing else to do.&lt;/p&gt;

&lt;p&gt;And I don’t contribute because I’m simply looking for something to put on my GitHub profile.&lt;/p&gt;

&lt;p&gt;I contribute because I believe open source is one of the places where we can actually build the future together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building Something Bigger Than Ourselves
&lt;/h2&gt;

&lt;p&gt;Software is strange.&lt;/p&gt;

&lt;p&gt;A few lines of code written by one person can eventually become something used by thousands—or even millions—of people.&lt;/p&gt;

&lt;p&gt;An idea that starts in one country can be improved by someone on the other side of the world.&lt;/p&gt;

&lt;p&gt;That is what makes open source special to me.&lt;/p&gt;

&lt;p&gt;You don’t need to work for the same company, live in the same city, or even speak the same native language to build something together.&lt;/p&gt;

&lt;p&gt;You need a shared problem and the willingness to contribute.&lt;/p&gt;

&lt;p&gt;Every issue, pull request, discussion, review, and idea can become part of something much larger than the individual who created it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Source Is Also About People
&lt;/h2&gt;

&lt;p&gt;I think there is another side of open source that is easy to overlook.&lt;/p&gt;

&lt;p&gt;Open source isn't only about code.&lt;/p&gt;

&lt;p&gt;It is also a place where people meet.&lt;/p&gt;

&lt;p&gt;Different countries.&lt;/p&gt;

&lt;p&gt;Different cultures.&lt;/p&gt;

&lt;p&gt;Different ways of thinking.&lt;/p&gt;

&lt;p&gt;Different personalities.&lt;/p&gt;

&lt;p&gt;A developer from Japan might approach a problem differently from someone in Europe. Someone with a completely different background might notice something the original author never considered.&lt;/p&gt;

&lt;p&gt;Those differences aren't necessarily friction.&lt;/p&gt;

&lt;p&gt;Sometimes, they're exactly what makes a project better.&lt;/p&gt;

&lt;p&gt;Open source creates a unique kind of global community where the first thing people can see is often not your nationality, background, or job title.&lt;/p&gt;

&lt;p&gt;They see what you build.&lt;/p&gt;

&lt;p&gt;They see how you think.&lt;/p&gt;

&lt;p&gt;They see how you communicate.&lt;/p&gt;

&lt;p&gt;They see how you help others.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contribution Is Not Charity
&lt;/h2&gt;

&lt;p&gt;I don't see open-source contribution as charity.&lt;/p&gt;

&lt;p&gt;I see it as an exchange.&lt;/p&gt;

&lt;p&gt;I give something to a project, but I also receive something in return.&lt;/p&gt;

&lt;p&gt;I learn from other engineers.&lt;/p&gt;

&lt;p&gt;I encounter problems I might never encounter in my day job.&lt;/p&gt;

&lt;p&gt;I see different architectures, implementations, and approaches.&lt;/p&gt;

&lt;p&gt;I become better at communicating technical ideas.&lt;/p&gt;

&lt;p&gt;And sometimes, I meet people I would never have met otherwise.&lt;/p&gt;

&lt;p&gt;The value isn't always immediate.&lt;/p&gt;

&lt;p&gt;Sometimes a contribution is a small fix that hardly anyone notices.&lt;/p&gt;

&lt;p&gt;Sometimes it becomes a feature used by thousands of people.&lt;/p&gt;

&lt;p&gt;And sometimes the most valuable result isn't the code at all.&lt;/p&gt;

&lt;p&gt;It's the person you meet while writing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  We Don't Know What Comes Next
&lt;/h2&gt;

&lt;p&gt;Technology changes incredibly quickly.&lt;/p&gt;

&lt;p&gt;The tools and technologies we consider essential today may look completely different a few years from now.&lt;/p&gt;

&lt;p&gt;That's one reason I enjoy contributing to open source.&lt;/p&gt;

&lt;p&gt;It gives me a chance to participate in that change instead of simply watching it happen.&lt;/p&gt;

&lt;p&gt;We don't know exactly what the future will look like.&lt;/p&gt;

&lt;p&gt;But we can influence it.&lt;/p&gt;

&lt;p&gt;We can experiment.&lt;/p&gt;

&lt;p&gt;We can build.&lt;/p&gt;

&lt;p&gt;We can challenge existing ideas.&lt;/p&gt;

&lt;p&gt;We can improve what already exists.&lt;/p&gt;

&lt;p&gt;And we can do it together.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Reason
&lt;/h2&gt;

&lt;p&gt;So, if someone asks me why I contribute to open source, my answer is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I want to build a brighter future together with other people.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I want open source to remain more than a collection of repositories.&lt;/p&gt;

&lt;p&gt;I want it to remain a place where ideas cross borders, where different perspectives meet, and where people with completely different backgrounds can work toward the same goal.&lt;/p&gt;

&lt;p&gt;Most importantly, I want a contribution from one person to have the potential to become useful to someone they've never met.&lt;/p&gt;

&lt;p&gt;That's the part of open source that keeps me contributing.&lt;/p&gt;

&lt;p&gt;Not because I have nothing else to do.&lt;/p&gt;

&lt;p&gt;Because I believe it's worth doing.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
