Simple bash script to name a tab in iTerm

I like to open a lot of tabs in iTerm, the open source replacement for Apple’s Terminal.app on the Mac. Unfortunately, its easy to forget which is which, as typically they don’t get very descriptive names.

In particular, I have a few scripts I run which will automatically ssh into a remote server, and run screen. When I wanted to find one of these, I’d often have to click several tabs to see which one I wanted (since they would all, rather unhelpfully, be called “ssh”).

So I wrote a simple script, which I call “nametab”, which allows you to name the tab you are in from the command line. You just type something like:

$ nametab New tab name

If you’d like to use this yourself, here is the code:

Just put it in a file in your PATH, and ensure that it is executable (ie. do a chmod u+x nametab).

2 thoughts on “Simple bash script to name a tab in iTerm

Leave a Reply

Your email address will not be published. Required fields are marked *