Member-only story

Automatic profile switching in iTerm2

Distinguish projects and environments with an easy hack

Kacper Kula
3 min readAug 30, 2019

Terminals are great. They allow you to run any command in any folder on any machine unrestricted. But with great power comes great responsibility. Quite often you are just one-command-away from running the wrong command in the wrong project (on or the wrong server) which can erase all your changes or even destroy the production.

The problem is that usually, all our terminals are the same colour (usually black). It’s hard to tell at a glance if you are in the right project directory or even ssh-ed to the right machine. Have you heard all these stories that someone cleared the production thinking that they are on the staging environment?

Fortunately, the iTerm 2 has really nice feature which allows you to change the iTerm Profile based on your current path or the machine you are running on (when connected remotely). You can also set the badges (big texts in the background on the following screenshot) to have more context on where you are now.

--

--

Kacper Kula
Kacper Kula

No responses yet