MauroBaptista.com

Organizing terminal tabs

August 25, 2021

When opening tabs in terminal, it usually adds in the tab name the user + the folder you are, but it takes too much space and don’t help much.

Unnamed tabs

To help me navigate faster between the tabs, I’ve added the following code to my ~/.bash_profile:

function title() {
   CMD='echo -en "\033]0;'
   CMD+=$1
   CMD+='\a"'

   PS1='\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
   PROMPT_COMMAND=$CMD
}

After run source ~/.bash_profile or if you close an open the terminal again, you will be able to add helpful names to your tabs:

title project or title "sentence with space"

It wil make your tabs name be like:

Named tabs

Hope it can help you! :) (Also if you have a better approach to it, let me know at Twitter)


Mauro Baptista

Mauro Baptista

Building stuff with code and having fun in the way

© 2021, Built with Gatsby