I've been reading about this topis here and tried the solution given to change the terminal name (refer to the picture on item number 1)
But none of them can change the terminal's name (item number 1).
user@linux:~$ gnome-terminal --title="SOME TITLE HERE"
user@linux:~$
user@linux:~$ PROMPT_COMMAND='echo -ne "\033]0;SOME TITLE HERE\007"'
user@linux:~$
user@linux:~$ echo -ne "\033]0;SOME TITLE HERE\007"
user@linux:~$
I know that item number 2 can be changed with PS1
. But the title (item number 1) still didn't change even after I change the PS1
user@linux:~$
is fine. I don't want to change this, I just want to rename the terminal's title on the top (item number 1)
The feature
gnome-terminal --title
have been removed since Gnome v3If you want to keep Gnome Terminal and change the Window title you will have to play with PS1, see below how to do it.
The Gnome 2 terminal has been forked as mate-terminal bundled in Ubuntu Mate. The
title
option is still available with this versionsudo apt-get install mate-terminal
With Gnome Terminal, a way to set the window title will be to play with PS1
You can add a function to your
.bashrc
file an call it to change the Window/Tab titlenano ~/.bashrc
Add the function
source ~/.bashrc
to reloadset-title Some new title
to change the Window/Tab titleLimitation: when a program changes the PS1, the title may change too (example: ssh to another host will reset the custom title)
hostnamectl set-hostname
on 13.10+ desktopThis is the best way if you have systemd (13.10 onwards) and if cloud-init is not active (see below):
It:
More info at: https://askubuntu.com/a/516898/52975
18.04 onwards: cloud-init
18.04 Introduced cloud-init which can control setting of the hostname so
hostnamectl
changes it won't stick after a reboot if cloud-init is installed. TODO: how to check if it is installed, is it installed by default on the desktop image or just server?If you want
hostnamectl
changes to stay after a reboot, then you'll need to edit the cloud-init config files, disable cloud-init's hostname set/update module:or disable cloud-init entirely:
See also: How do I change the hostname without a restart?