ubuntu 個性環境配置

如果當裝好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,會提示確認退出。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章