Rename terminal tab

Hi,

I am Python programmer and the Linux admin for our company.

I love using Gnome (Ubuntu 18.04) for work.

Usually I have 10 terminal tabs open for my different servers / Python projects - and they are all called “terminal” :frowning:

I tried right-click to rename them, I tried several bash-scripts which should allow renaming - nothing worked.

Is there are current way to rename the tabs in the GNOME Terminal application? Or is it planned to introduce this feature?

Thank you very much!

Right click on the tab offers a menu item to set title here. What version on which distribution are you running?

1 Like

OP uses Ubuntu 18.04 so that would be 3.28.1 according to https://packages.ubuntu.com/bionic/gnome-terminal.

However, I use vanilla GNOME Terminal 3.36.1.1 on NixOS and see no such menu item either:

image

❯ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

~ 
❯ gnome-shell --version
GNOME Shell 3.28.4

~ 
❯ 

I have the same buttons as @jtojnar showed in the screen shot

Move Terminal Left
Move Terminal Right
Detach Terminal
Close Terminal

P.S.: My screenshot keyboard combination “Fn” + “F11” does not work when the “right click menu” is open :frowning:

This is an fundamental X11 limitation: open popup menus inhibit all global keybindings and even screen locking. It is fixed by switching to a Wayland-based session.

1 Like

What bash scripts have you tried? printf "\033]0;%s\a" "some title" should work. I have wrapped it in a script for convenience.

1 Like

I certainly must have tried the wrong bash script - yours work like a charm!

Thank you very much, Marius.

Could you either give me some keywords or a link or a quick explanation why printing some “control keys” are able to modify the terminal tab? Reminds me a little bit of the PS1 variable.

While we are at it… sometimes, when I ssh into another server, my tab title gets changed…

Most terminal emulators implement xterm’s control sequences. ESC [ is the prefix for Operating System Commands (OSC). OSC 0 sets the window title in xterm (which doesn’t have tabs).

One common use of this (enabled by default in the ~/.bashrc of some distros) is to have PS1 emit the OSC 0 sequence to set the terminal title to display the current working directory. This might be what you’re observing when you SSH somewhere.

In fact you ought to be seeing this locally too, because in Ubuntu the default .bashrc also does this!, when $TERM is set to xterm* or rxvt*. You must be using a custom .bashrc, or maybe a different shell, or maybe some terminal multiplexer (screen/tmux) that changes $TERM.

You can run gnome-screenshot and ask it to take a whole screen screenshot after a delay. Then you can open a menu and wait for a flash. That works at least on X; though you need to crop it in GIMP or some other app.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.