在以前的 Ubuntu 版本中,例如 14.04,可以通过菜单设置每个终端选项卡的标题:终端 -> 设置标题...
在 18.04 中,仍然有带有设置字符编码等选项的终端终端,但缺少设置标题。
那么如何在较新版本中设置标题?
此功能自 gnome 3 起被移除
但是,gnome 2 终端已分叉为 mate-terminal,它具有您想要的功能。
sudo apt-get install mate-terminal
Run Code Online (Sandbox Code Playgroud)
1- 将函数“set-title”添加到 .bashrc
2- 重命名终端标题set-title The New Title Name
nano ~/.bashrc
##Add the following to the .bashrc file
function set-title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}
Run Code Online (Sandbox Code Playgroud)
用法 : set-title My Tab Title
| 归档时间: |
|
| 查看次数: |
2061 次 |
| 最近记录: |