Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 659315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:01:50+00:00 2026-05-13T23:01:50+00:00

I recently added these lines to my ~/.bashrc file to show the current branch

  • 0

I recently added these lines to my ~/.bashrc file to show the current branch if i’m in a git working folder, and it works nicely for that. However, what i’ve lost is that the current folder name used to be shown in the tab for the terminal i have open, and now it isn’t: it always just says ‘Terminal’. Can i get that back and still keep the git stuff? Here’s the lines in question – it’s the second one that’s the issue, as commenting out just the second line fixes the problem.

source /etc/bash_completion.d/git
PS1='\h:\w$(__git_ps1 "\[\e[32m\][%s]\[\e[0m\]")$ '

I’ve been looking at explanations of the options for PS1 but can’t see anything about the terminal window’s title in there. Can anyone advise? thanks, max

EDIT

I actually manipulate PS1 already in order to have a terminal with the format

<rvm version and gemset> <computer name> <current folder> <git branch>

, with each part in a different color, but i’ve never actually seen the docs before, so thanks for the link to that. My current PS1 setting is

\[\033[0;31m\]$(__my_rvm_ruby_version)\[\033[0;33m\]\h\[\033[0;37m\]:\[\033[1;33m\]\W\[\033[1;32m\]$(__git_branch)\[\033[1;32m\]$(__git_dirty) \[\033[0;37m\]$

Presumably i can do something like

export "<something> $PS1"

to set my terminal tab name without losing my existing settings. I’ve been poking around with this though and not managed to do it.

EDIT – figured this out with the help of some of the answers below – thanks all! I wrapped it up in a shell script

#!/usr/bin/env bash
#renames the current terminal tab via the PS1 env var
source ~/.bashrc
export PS1="$PS1""\[\e]0;$1 \a\]"

it’s called “renametab” so i can now call it with eg

source renametab mytabname

“source” is needed to export the changes into the current shell: if i just do renametab mytabname the export just goes into a subshell which is killed when the script finishes.

Thanks again all, for the help!

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:01:50+00:00Added an answer on May 13, 2026 at 11:01 pm

    That’s what I have as default on my Ubuntu concerning the terminal’s title:

    PS1='\[\e]0;\u@\h: \w\a\]'
    

    Prepend your PS1 with this one and it should be fine

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently added the JQuery autocomplete plug in and have a textbox that autocompletes
I've recently added this little bit of code to my .htaccess file: RewriteCond %{REQUEST_FILENAME}
I recently added the line (set-default-font -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1) to my .emacs file. After that find-file-other-window
I added a new client-side JS lib (typeAheadDemo.js) to my theme recently, but the
I recently added -pedantic and -pedantic-errors to my make GCC compile options to help
I recently added JQuery's date-picker control to a project. In Internet Exploder, I get
I recently added a feature to a large application written in Delphi (version 2009)
I recently added CKEditor to my app and I would like to include my
I recently added a parameter to one of the method of a wcf. It
I recently added some url re-writing to my web application and had to added

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.