Set title and badge text in iterm
<p>Something I have found that helps me when I have multiple tabs open in my terminal is to set the title and badge text; I do this by pressing <code>Cmd + i</code> and manually setting it.</p>

<p>What I would find even more beneficial is a command line option to set these up.</p>

<p>I have found a function to set the title, but not the badge:</p>

<pre><code># Set Terminal Tab Title
function title {
    echo -ne "\033]0;"$*"\007"
}
</code></pre>

<p>Moving one step on from this, I would like to be able to call the function and have it set the title based upon the directory that I am in currently.</p>

<p>Does anyone know how to arrange this?</p>

<p>So I have two questions:</p>

<ol>
<li><p>How can I set the iTerm tab title to the directory that I am in currently?</p></li>
<li><p>How can I do the same for the badge?</p></li>
</ol>