# Stream command output from a Chef recipe

Posted by ZedTuX 0n R00t on July 29, 2019

In this article I will show you how to see, in real-time, a command output from a Chef recipe.

## Executing a command, the chef way

As a command example, as I’m working with it right now, let’s take the Kubernetes installation tool: kubeadm.

This app tells you what he is doing in its output.

I first did this:

While this runs the command successfully, all the command’s output is invisible:

1
2
3
* execute[kubeadm init] action run



## Executing a command, the Ruby way

Let’s now make this real-time :

Now you get the command output in real time:

1
2
3
4
5
* ruby_block[kubeadm init] action run[init] Using Kubernetes version: v1.15.1
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
...


🎉