← Back Home

bash fifos and golang channel

  1. general
  2. blog

I have been reading about bash this weekend and came to know about FIFOs. After first glance I found similarities between named pipes and golang channel.

FIFOs are created using the mkfifo command.

$ mkfifo test

FIFOs provide a named pipe to shuttle data from one place to another. If we create a FIFO and send some data to it, it will remain blocked forever, until a command tries to read from it. If you are familiar with golang and golang channels, that’s an Unbuffered/synchronous channel. Unbuffered channel blocks until there is a receiver receiving from a channel.

named pipes are very interesting and can be used in some interesting ways.