DEV Community

Vivek Kodira
Vivek Kodira

Posted on • Updated on

Using Badges in iTerm2

Update: 1-Aug-2019: The example mentioned in this post is now redundant. Use iTerm's status bar instead.

iTerm2 is a very powerful replacement to the built-in terminal. You can read more about why here.

This post will focus on one specific functionality I recently explored and found useful: Badges and is meant for beginners unfamiliar with iTerm2

Hello World

Let's start with a "Hello World" example.

  • Go to "iTerm2 > Preferences > Profiles"
  • Add the text "HelloWorld" to the input "General -> Basics -> Badge"

  • If you open up a new iTerm2 window, you should now see this:

  • This badge will be displayed in each tab. Split the window into two tabs and this is what you'll see.

  • Now lets make the badge display something useful like the name of the user and the machine. To do this, we'll first need to install Shell Integration

  • Now, go back to the Preferences panel and change the Badge to \(session.username)@\(session.hostname)

  • iTerm will now display a more useful badge

Important: The "Install Shell Integration" step will have to be done on each host you ssh into before you'll see the correct label.

Enjoy,
Vivek.

P.S: Badges also support more advanced features like user-defined variables. Experiment with them to get the look-and-feel you need. All you need to know is some basic bash scripting

References

Top comments (0)