You are here

How to Efficiently Rename Your Linux Terminal Windows: A Simple Guide for Ubuntu & CentOS Users


How to Efficiently Rename Your Linux Terminal Windows: A Simple Guide for Ubuntu & CentOS Users

Managing multiple terminal windows in Linux, especially when you have numerous tasks running simultaneously, can quickly become confusing. Have you ever found yourself in a situation where you have ten windows open and they all look identical? If you're like most Linux users, distinguishing between them can be a challenge.

In this guide, we will specifically discuss an easy method to rename your terminal windows. This will not only make your workflow more organized but also reduce the chance of making errors due to working in the wrong window. We'll be using the gnome-terminal as an example, particularly focusing on Ubuntu 16.04. But if you're a CentOS user, don't worry! We have something for you too.

Step-by-Step: Setting a Custom Terminal Window Title

  1. Editing the bashrc File:

    Use the following command to edit the file:

    • For individual users: Open ~/.bashrc
    • For all system users: If you're on Ubuntu, navigate to /etc/bash.bashrc. For CentOS users, the path is /etc/bashrc.
nano /etc/bash.bashrc

 

  1. Adding the Custom Function:

Append this function to the end of the file:

function set-title(){
  if [[ -z "$ORIG" ]]; then
    ORIG=$PS1
  fi
  TITLE="\[\e]2;$*\a\]"
  PS1=${ORIG}${TITLE}
}
  1. Activating the Change:

Restart your terminal or if you're working remotely via ssh, reconnect to see the changes.

  1. Renaming Your Terminal Window:

Simply type:

set-title your title
And just like that, your terminal window will have a new, easily distinguishable name! Remember, if you're using ssh, ensure to execute this on your remote server.

Conclusion

Mastering little efficiency tricks like renaming your terminal windows can drastically improve your productivity when working with Linux. Looking for more Linux tips and tricks? Stay tuned to our blog for more insights and step-by-step guides!

 

0 0

Share the article with your friends in social networks, maybe it will be useful to them.


If the article helped you, you can >>thank the author<<