Linux分屏终端terminator的安装、简单字体颜色配置以及如何恢复默认终端

1安装

ctrl+alt+t 打开终端

运行命令

sudo apt-get install terminator
2常用命令
Ctrl+Shift+O
    Split terminals Horizontally.(上下开新窗口)
Ctrl+Shift+E
    Split terminals Vertically.(垂直开新窗口)
Ctrl+Shift+Right
    Move parent dragbar Right.(放大当前窗口 向右)
Ctrl+Shift+Left
    Move parent dragbar Left.
Ctrl+Shift+Up
    Move parent dragbar Up.
Ctrl+Shift+Down
    Move parent dragbar Down.
Ctrl+Shift+W
    Close the current terminal.
Alt+Up
    Move to the terminal above the current one.(切换当前窗口)
Alt+Down
    Move to the terminal below the current one.
Alt+Left
    Move to the terminal left of the current one.
Alt+Right
    Move to the terminal right of the current one.
Ctrl+Shift+S
    Hide/Show Scrollbar.(隐藏滚动条)
Ctrl+Shift+F
    Search within terminal scrollback
Ctrl+Shift+N or Ctrl+Tab
    Move to next terminal within the same tab, use Ctrl+PageDown to move to the next tab. If cycle_term_tab is False, cycle within the same tab will be disabled
Ctrl+Shift+P or Ctrl+Shift+Tab
    Move to previous terminal within the same tab, use Ctrl+PageUp to move to the previous tab. If cycle_term_tab is False, cycle within the same tab will be disabled
Ctrl+Shift+C
    Copy selected text to clipboard
Ctrl+Shift+V
    Paste clipboard text
Ctrl+Shift+Q
    Quits Terminator
Ctrl+Shift+X (最大化当前窗口)
    Toggle between showing all terminals and only showing the current one (maximise).
Ctrl+Shift+Z
    Toggle between showing all terminals and only showing a scaled version of the current one (zoom).
Ctrl+Shift+T
    Open new tab
Ctrl+Shift+Alt+T
    Open new tab at root level, if using extreme_tabs.
Ctrl+PageDown
    Move to next Tab
Ctrl+PageUp
    Move to previous Tab
Ctrl+Shift+PageDown
    Swap tab position with next Tab
Ctrl+Shift+PageUp
    Swap tab position with previous Tab
Ctrl+Shift+F
    Open buffer search bar to find substrings in the scrollback buffer. Hit Escape to cancel.
Ctrl+Plus (+)
    Increase font size. Note: this may require you to press shift, depending on your keyboard
Ctrl+Minus (-)
    Decrease font size. Note: this may require you to press shift, depending on your keyboard
Ctrl+Zero (0)
    Restore font size to original setting.
F11
    Toggle fullscreen(放大当前窗口)
Ctrl+Shift+R
    Reset terminal state
Ctrl+Shift+G
    Reset terminal state and clear window

3.简单配置

  原本的终端界面很丑,命令行全为白色,命令与其他内容难以区分,不易查找,还有可能出现文字重叠交错等问题,所以从网上学了一些简单的配置方法。

打开终端,空白位置鼠标右键点击,选择preferences进行简单设置。如下图,Colors  里,Built-in schemes 处可以设置背景颜色和字体颜色。General 里修改字体为FreeMono即可解决字体重叠问题。其他的一些设置可以自己根据个人需求修改。


效果


4.PS1修改命令行各字体颜色

   经过上述配置后,命令行依旧全是同一种颜色,很难从运行成果中找到自己输入的命令行。下面可参考https://www.cnblogs.com/Q--T/p/5394993.html 里的内容进行配置。

在终端输入:

echo $PS1   

得到当前的PS1值

yy@yy-ThinkPad-T470p:~$  echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
PS1的常用参数以及含义:

  \d :代表日期,格式为weekday month date,例如:"Mon Aug 1"

  \H :完整的主机名称

  \h :仅取主机名中的第一个名字

  \t :显示时间为24小时格式,如:HH:MM:SS

  \T :显示时间为12小时格式

  \A :显示时间为24小时格式:HH:MM

  \u :当前用户的账号名称

  \v :BASH的版本信息

  \w :完整的工作目录名称

  \W :利用basename取得工作目录名称,只显示最后一个目录名

  \# :下达的第几个命令

  \$ :提示字符,如果是root用户,提示符为 # ,普通用户则为 $

在PS1中设置字符序列颜色的格式为:[\e[F;Bm]。其中“F”为字体颜色,编号30~37;“B”为背景色,编号40~47。

          颜色对照表:

    F    B

    30  40 黑色

    31  41 红色

    32  42 绿色

    33  43 黄色

    34  44 蓝色

    35  45 紫红色

    36  46 青蓝色

    37  47 白色

我的设置如下:
PS1="\[\e[30;42m\][\[\e[35;42m\]\u\[\e[30;42m\]@\h \[\e[33;42m\]\w\[\e[0m\]]\\$ "

打开 .bashrc文件(vim 或者 gedit 或其他编译器,都可以)

找到文件里如下图所示几行



xterm*|rxvt*)

    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;

*)

这几行里原本的PS1设置注释掉,插入

PS1="\[\e[30;42m\][\[\e[35;42m\]\u\[\e[30;42m\]@\h \[\e[33;42m\]\w\[\e[0m\]]\\$ "

保存关闭,在终端输入

source .bashrc 

生效就可以了。

这里配置比较复杂,我直接按照上面连接里博主的提示改的。

效果图:


5.更改 Ubuntu 默认终端工具

在 Ubuntu 系统中默认使用的终端工具是 gnome-terminal,而当我们安装完 Terminator 之后,Ubuntu 系统中默认采用的终端工具就变成了 Terminator,可以借助dconf-tools 工具来进行重新设置。

 安装dconf-tools

sudo apt-get install dconf-tools
安装成功后,终端中输入命令 “dconf-editor” 来打开这个工具,然后从左边的的菜单栏中按照下面的步骤依次进入指定的菜单项:
org > gnome > desktop > applications > terminal
此时,我们可以看到使用 Terminator 作为默认终端工具的配置为:
exec  x-terminal-emulator

exec-arg -e


如果想使用 gnome-terminal 为默认终端工具的话,就将上面的配置更改为:
exec  gnome-terminal

exec-arg -x


保存退出之后,使用快捷键 “Ctrl + Alt + T” 启动一个终端时,这时启动起来的就是 gnome-terminal 工具了!

猜你喜欢

转载自blog.csdn.net/weixin_41822560/article/details/80941083
今日推荐