(+91) 7 999 01 02 03

Code to set custom Title in BASH Terminal

Ismail Momin
1 Posts

Hi Big Data enthusiast !

  All Big Data Developers have to get accustomed to using the Linux OS which can be a new experience for some. Most Linux users, from both admin & development teams, spend a significant time interacting with the BASH Terminal (Using the keyboard ombination of (CTRL + SHIFT + T).

 Over the course of your big data journey you might find yourself working with multiple tabs in Bash Terminal like-

  • One Tab to access HDFS directly,
  • Another tab to log in HIVE/HBASE interface
  • You may also install MySQL DB & use a separate tab for modifying MySQL databases. 
  • Sometimes you might also maintain a separate tab for running Pig commands.

Accordingly, Ubuntu had the option to modify the title of BASH terminal so that users could set custom Titles w.r.t respective systems for simplicity. Unfortunately, If you are using Ubuntu 20.04 LTS version this feature is no longer availble.

Great thing about LINUX is that users have contributed rich custom codebase to this open source forum. In this Tutorial, we will also be iusing a custom function code to obtain this functionality. Let's start !


Step 1 - Open Terminal by one of the 2 methods

  • Press Keys CTRL + SHIFT + T at once


  • Right Click on Ubuntu DesktopOpen in Terminal

Step 2 - Since we are in Desktop, lets navigate to Home directory


Lets use ls coomand to check the files & folders in Home directory, using the modifier -a will also display hidden files. Notice the .bashrc file is located here.

Step 3 - We will now edit .bashrc file using the in-built vim editor.


This will open the Text Editor. Press 'i' to enter INSERT MODE & paste the below code at the end of the file. 

####Code for Custom BASH Terminal Title #####
function set-title(){
if [[ -z "$ORIG" ]]; then
####Code for Custom BASH Terminal Title #####

 Now, press the 'Esc' key to get out of INSERT mode. Finally we will save the changes by pressing :wq

Here's how thse screen will look - 


DONE ! Then use your custom command to set the terminal title. It works with spaces in the name too.

set-title newtabtitle

  Let's assume you want to Log in to HIVE using the terminal,  Type 'set-title Hive' , this will rename the Termnal title to Hive.


 Similarly, you can now open multiple BASH Tabs/Windows & rename the title to simplify your workspace laughing



Published By : Ismail Momin
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.


Jquery Comments Plugin