Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Tutorial: Configure tab titles in Windows Terminal

Feedback

In this article

By default, the tab title is set to the shell's title. If a tab is composed of multiple panes, the tab's title is set to that of the currently focused pane. If you want to customize what is set as the tab title, follow this tutorial.

In this tutorial, you learn how to:

  • Use thetabTitle setting
  • Set the shell's title
  • Using thesuppressApplicationTitle setting

Use thetabTitle setting

ThetabTitle setting allows you to define the starting title for a new instance of a shell. If it is not set, the profilename is used instead. Each shell responds to this setting differently.

ShellBehavior
PowerShellThe title is set.
Command PromptThe title is set. If a command is running, it is temporarily appended to the end of the title.
UbuntuThe title is ignored, and instead set touser@machine:path
DebianThe title is set.

Note

Though Ubuntu and Debian both run bash, they have different behaviors. This is to show that different distributions may have different behaviors.

Set the shell's title

A shell has full control over its own title. However, each shell sets its title differently.

ShellCommand
PowerShell$Host.UI.RawUI.WindowTitle = "New Title"
Command PromptTITLE New Title
bash*echo -ne "\033]0;New Title\a"

Note that some Linux distributions (e.g. Ubuntu) set their title automatically as you interact with the shell. If the above command doesn't work, run the following command:

export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ 'echo -ne '\033]0;New Title\a'

This will change the title to 'New Title'.

For easier access add this to the end of your~/.bashrc:

settitle () {  export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '  echo -ne '\033]0;'"$1"'\a'}

After you reopen your shell, you now can change the shell's title at any time using the following command:

settitle 'New Title'

Use thesuppressApplicationTitle setting

Since a shell has control over its title, it may choose to overwrite the tab title at any time. For example, theposh-git module for PowerShell adds information about your Git repository to the title.

Windows Terminal allows you to suppress changes to the title by settingsuppressApplicationTitle totrue in your profile. This makes new instances of the profile set your visible title totabTitle. IftabTitle is not set, the visible title is set to the profile'sname.

Note that this decouples the shell's title from the visible title presented on the tab. If you read the shell's variable where the title is set, it may differ from the tab's title.

Resources

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?