<p>I am able to get the jobs under the namespace using kubectl command:</p>
<pre><code>kubectl get jobs --namespace xxx
</code></pre>
<p>This is giving me the jobs information</p>
<p><a href="https://i.stack.imgur.com/X0j22.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X0j22.png" alt="enter image description here" /></a></p>
<p>I would like to print the count of jobs using kubectl command. How to do that?</p>

Ayushi Gupta
<p><code>go-template</code> way, no pipes or installation needed. Just good old kubectl:</p>
<pre><code>kubectl get jobs --namespace xxx -o go-template='{{printf &quot;%d\n&quot; (len  .items)}}'
</code></pre>
<p><code>len</code> is an inbuild function in <code>go-template</code> to return the number of elements to its argument. Eg: <code>items</code>.</p>
