ubuntu16.04編程軟件之工具類
阿新 • • 發佈:2018-11-24
o-c lar files 自帶 跳轉 ctrl+s ash def 目錄
zsh
安裝zsh
+ zsh 兼容bash
+ zsh 官網:Zsh
+ 查看CentOS已安裝的shell
cat /etc/shells
正常結果應該是這樣的:
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
+ 查看當前的shell
echo $SHELL
- 更新軟件源
sudo apt-get install update
- 安裝zsh
sudo apt-get install zsh
安裝oh-my-zsh
保證已經安裝好git和wget
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
完成後將shell設置為zsh模式
sudo chsh -s /bin/zsh
重啟或註銷下就OK了
配置zsh
zsh文件的位置為: ~/.zshrc,每一項配置在文件中有詳細的解釋。
- 修改主題:
ZSH_THEME=”ys”
- 添加插件
plugins=(git autojump)
目前用到的自定義配置不多,更改配置後需要重啟終端。
插件推薦
- 強力跳轉:autojump
sudo apt-get install autojump
然後編輯~/.zshrc,plugins=(git autojump)
- 強力自動補全
1.下載 http://mimosa-pudica.net/zsh-incremental.html 的incr-0.2.zsh 2.把incr-0.2.zsh放到新建的~/.oh-my-zsh/plugins/incr目錄下 3.chmod 777 incr-0.2.zsh給予其777權限 4.編輯~/.zshrc,插入source ~/.oh-my-zsh/plugins/incr/incr-0.2.zsh
- wd
簡單地講就是給指定目錄映射一個全局的名字,以後方便直接跳轉到這個目錄,比如:
編輯配置文件,添加上 wd 的名字:vim /root/.zshrc
我常去目錄:/opt/setups,每次進入該目錄下都需要這樣:cd /opt/setups
現在用 wd 給他映射一個快捷方式:cd /opt/setups ; wd add setups
以後我在任何目錄下只要運行:wd setups 就自動跑到 /opt/setups 目錄下了
插件官網:https://github.com/mfaerevaag/wd
+ zsh-syntax-highlighting
這個插件會對終端命令高亮顯示,比如正確的拼寫會是綠色標識,否則是紅色,另外對於一些shell輸出語句也會有高亮顯示,算是不錯的輔助插件 插件官網:https://github.com/zsh-users/zsh-syntax-highlighting 安裝,復制該命令:'git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting' 編輯:vim ~/.zshrc,找到這一行,後括號裏面的後面添加:plugins=( 前面的一些插件名稱 zsh-syntax-highlighting) 刷新下配置:source ~/.zshrc
主題
- oh-my-zsh 的主題列表介紹(還是太長了):https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
- 我們看下安裝 oh-my-zsh 的時候,自帶有多少個:ls -l /root/.oh-my-zsh/themes |grep "^-"|wc -l,我這邊得到的結果是:140
推薦(排名有先後):
ys
agnoster
avit
blinks
其他
- 呃,這個其實可以不用講的,你自己用的時候你自己會發現的,各種便捷,特別是用 Tab 多的人一定會有各種驚喜的。
- 使用 ctrl-r 來搜索命令歷史記錄。按完此快捷鍵後,可以輸入關鍵命令詞語,如果歷史記錄有含有此詞語會顯示出來。
- 命令別名:
在命令行中輸入 alias 可以查看已經有的命令別名
自己新增一些別名,編輯文件:vim ~/.zshrc,在文件加入下面格式的命令,比如以下是網友提供的一些思路:
alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias grep="grep --color=auto"
alias -s html='vim' # 在命令行直接輸入後綴為 html 的文件名,會在 Vim 中打開
alias -s rb='vim' # 在命令行直接輸入 ruby 文件,會在 Vim 中打開
alias -s py='vim' # 在命令行直接輸入 python 文件,會用 vim 中打開,以下類似
alias -s js='vim'
alias -s c='vim'
alias -s java='vim'
alias -s txt='vim'
alias -s gz='tar -xzvf' # 在命令行直接輸入後綴為 gz 的文件名,會自動解壓打開
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'
- 我們現在增加系統變量在:/etc/profile 後,輸入命令:source /etc/profile 之後,重啟服務器發現剛剛的系統變量現在沒效果。解決辦法:vim ~/.zshrc,在該配置文件裏面增加一行:source /etc/profile,然後刷新 zsh 的配置:source ~/.zshrc。
參考
- oh-my-zsh使用記錄 - milletluo的博客 - CSDN博客
- Zsh 入門(安裝及使用) - T-MacFBMa的博客 - CSDN博客
teminator
terminator 安裝
sudo apt-get install terminator
常用快捷鍵
Ctrl+Alt+T 新建窗口
Ctrl+Shift+T 新建標簽頁
Ctrl+Shift+O (水平分割窗口)
Ctrl+Shift+E(垂直分割窗口)
Alt+Up (切換窗口)
Alt+Down
Alt+Left
Alt+Right
配置
為了讓terminator更加美觀
- 修改terminator的config文件
~/.config/terminator/config
將以下內容替換掉原來的內容
[global_config]
focus = system
suppress_multiple_term_dialog = True
tab_position = bottom
title_transmit_bg_color = "#d30102"
window_state = maximise
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
type = Terminal
[[[window0]]]
parent = ""
type = Window
[plugins]
[profiles]
[[default]]
background_color = "#002b36"
background_darkness = 0.92
background_image = None
background_type = transparent
cursor_color = "#eee8d5"
font = Monospace 11
foreground_color = "#e6e0da"
icon_bell = False
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#586e75:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
split_to_group = True
參考
Solarized-Dark theme configuration in Terminator – Diwakar Moturu – Medium
ubuntu16.04編程軟件之工具類