MauroBaptista.com

Organizing terminal tabs

Terminal Organization

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:

1function title() {
2 CMD='echo -en "\033]0;'
3 CMD+=$1
4 CMD+='\a"'
5 
6 PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
7 PROMPT_COMMAND=$CMD
8}

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)