现在的位置: 首页 > 综合 > 正文

ubuntu 个性环境配置

2018年04月30日 ⁄ 综合 ⁄ 共 2356字 ⁄ 字号 评论关闭

如果当装好ubuntu后,却发现终端提示符@后面的名字太长或者不舒服,比如为linxd@name,这个name就不好听,想要改怎么办?

1、需修改两个文件:vim  /etc/hosts 将里面的name改为ubuntu;
                                 vim /etc/hostsname 将里面的name改为ubuntu。
    重启ubuntu,再次打开终端就可以看到修改成功,变为了linxd@ubuntu:

2、现在,我想linxd@ubuntu这个提示符发亮,需要修改 vim ~/.bashrc,将里面的force_color_prompt=yes前面的注释‘#’去掉

     重新打开终端就可以看到提示符发亮吧

2.1这里还介绍一下如何修改提示符号的颜色

在命令行中输入:gedit ~/.bashrc

找到如下的内容

# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\[\033[00;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

修改后显示效果如下:

@前面是红色,@后面时黄色,:白色;~时蓝色;¥白色,命令行字符也是白色

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\[\033[00;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
'

上面的语句是我修改后的,根据颜色对应

[01;31m\]对应的参数,分号间隔,m结束

可能的颜色如下:
样式
00 -- Normal (no color, no bold)
01 – Bold
文字颜色
30 -- Black
31 -- Red
32 -- Green
33 -- Yellow
34 -- Blue
35 -- Magenta
36 -- Cyan
37 -- White
背景颜色
40 -- Black
41 -- Red
42 -- Green
43 -- Yellow
44 -- Blue
45 -- Magenta
46 -- Cyan
47 – White

3.串口软件安装和配置

1、下载:sudo apt-get install minicom
2、插入usb转串口线,终端输入:dmesg | grep usb
...............
[ 7415.893942] usbserial: USB Serial Driver core
[ 7415.931116] usb 3-1: ark3116 converter now attached to ttyUSB0
[ 7415.931141] usbcore: registered new interface driver ark3116
[ 7430.248072] usb 3-1: USB disconnect, address 2
[ 7434.588044] usb 3-1: new full speed USB device using uhci_hcd and address 3
...............
3、设置:minicom -s
serial port setup-->serial device:/dev/ttyUSB0
硬件数据流、软件数据流控制均设置为否
4、保存退出
5、命令窗口运行:minicom
----------------------------------------------------------------------------------------------------
注意:默认情况下ubuntu已经安装了USB转串口驱动(pl2303)。我的是ark3116,也是默认安装
1、# lsmod | grep usbserial
如果有usbserial,说明系统支持USB转串口。
yzj@yzj-laptop:~/minicom$ lsmod | grep usbserial
usbserial              36264  3 ark3116
2、插上USB转串口,在终端输入命令#dmesg | grep ttyUSB0,如果出现连接成功信息,则说明ubuntu系统已经识别该设备了。
----------------------------------------------------
组合键的用法是:先按Ctrl+A组合键,然后松开这两个键,再按Z键。另外还有一些常用的组合键。
(1)S键:发送文件到目标系统中;
(2)W键:自动卷屏。当显示的内容超过一行之后,自动将后面的内容换行。这个功能在查看内核的启动信息时很有用。
(3)C键:清除屏幕的显示内容;
(4)B键:浏览minicom的历史显示;
(5)X键:退出mInicom,会提示确认退出。

抱歉!评论已关闭.