新增task,名稱爲wsl::bash
,右下方的方框內填寫:php
"%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl --distro-guid={f24dabf4-473d-4aa4-92fd-364654228b77} -cur_console:pm:/mnt
這裏面的f24dabf4-473d-4aa4-92fd-364654228b77
指的是Ubuntu的惟一標識符,若是重裝了子系統,那麼這個標識符實惠變得。能夠在在註冊表(regedit)中查找 計算機\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss
。win+R搜索regedit
。css
查看系統中的shellhtml
cat /etc/shells or echo $SHELL
搜索看看倉庫裏和zsh相關的包有哪些java
sudo apt-cache search zsh
看到了包的說明後,咱們看看zsh包詳細說明node
sudo apt-cache show zsh
安裝zshpython
sudo apt-get install zsh -y
驗證下安裝是否成功mysql
$ zsh --version zsh 5.4.2 (x86_64-ubuntu-linux-gnu)
chsh -s /usr/bin/zsh or chsh -s $(which zsh)
chsh -s 其實修改的就是/etc/passwd 文件中和咱們所登陸的用戶名相對應的那一行react
$ cat /etc/passwd|grep ^qhong qhong:x:1000:1000:,,,:/home/qhong:/bin/zsh
若是在wsl系統中並不生效,那麼咱們能夠在.bashrc末尾加上shell代碼,當你打開bash時候切換到zsh。linux
bash -c zsh
orlaravel
if test -t 1; then exec zsh fi
wget https://files-cdn.cnblogs.com/files/hongdada/install.sh -O - | sh
進入~/.oh-my-zsh目錄後,看看該目錄的結構
qhong@hongda:/$ ls ~/.oh-my-zsh CODE_OF_CONDUCT.md LICENSE.txt cache lib oh-my-zsh.sh templates tools CONTRIBUTING.md README.md custom log plugins themes
lib 提供了核心功能的腳本庫
tools 提供安裝、升級等功能的快捷工具
plugins 自帶插件的存在放位置
templates 自帶模板的存在放位置
themes 自帶主題文件的存在放位置
custom 個性化配置目錄,自安裝的插件和主題可放這裏
Oh My Zsh 默認自帶了一些默認主題,存放在~/.oh-my-zsh/plugins
目錄中。咱們能夠查看這些插件
qhong@hongda:/$ ls ~/.oh-my-zsh/plugins adb cpanm git-flow-avh lighthouse pyenv systemadmin ansible dash git-hubflow lol pylint systemd ant debian git-prompt macports python taskwarrior apache2-macports dircycle git-remote-branch magic-enter rails terminalapp arcanist dirhistory gitfast man rake terminitor archlinux dirpersist github marked2 rake-fast terraform asdf django gitignore mercurial rand-quote textastic autoenv dnf glassfish meteor rbenv textmate autojump dnote globalias minikube rbfu thefuck autopep8 docker gnu-utils mix react-native themes aws docker-compose go mix-fast rebar thor battery docker-machine golang mosh redis-cli tig bbedit doctl gpg-agent mvn repo timer bgnotify dotenv gradle mysql-macports ripgrep tmux boot2docker droplr grails n98-magerun ros tmux-cssh bower drush grunt nanoc rsync tmuxinator branch eecms gulp ng ruby torrent brew emacs hanami nmap rust transfer bundler ember-cli helm node rvm tugboat bwana emoji heroku nomad safe-paste ubuntu cabal emoji-clock history npm salt ufw cake emotty history-substring-search npx sbt urltools cakephp3 encode64 homestead nvm scala vagrant capistrano extract httpie nyan scd vagrant-prompt cargo fabric iterm2 oc screen vault cask fancy-ctrl-z jake-node osx scw vi-mode catimg fasd jenv otp sdk vim-interaction celery fastfile jhbuild pass sfdx virtualenv chruby fbterm jira paver sfffe virtualenvwrapper chucknorris fd jruby pep8 shrink-path vscode cloudapp fedora jsontools per-directory-history singlechar vundle cloudfoundry firewalld jump percol spring wakeonlan codeclimate forklift kate perl sprunge wd coffee fossil keychain perms ssh-agent web-search colemak frontend-search kitchen phing stack wp-cli colored-man-pages fzf knife pip sublime xcode colorize gas knife_ssh pipenv sudo yarn command-not-found gatsby kops pj supervisor yii common-aliases gb kube-ps1 please suse yii2 compleat geeknote kubectl pod svcat yum composer gem laravel postgres svn z copybuffer git laravel4 pow svn-fast-info zeus copydir git-auto-fetch laravel5 powder swiftpm zsh-navigation-tools copyfile git-extras last-working-dir powify symfony zsh_reload cp git-flow lein profiles symfony2
Oh My Zsh默認是隻啓用git插件
plugins=(git)
如需啓用更多插件,可加入需啓用插件的名稱。以下
plugins=(git wd web-search history history-substring-search)
自動補全插件
$ git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
自動提示插件
$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
由於箭頭→
不太方便,在.zshrc
中自定義補全快捷鍵爲逗號,可是又一次遇到了須要輸入逗號的狀況,因此,並不太推薦以下修改:
# 補全快捷鍵重設 # bindkey ',' autosuggest-accept
語法高亮插件
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
編輯.zshrc
啓用插件
ZSH_THEME="ys" ............................ plugins=(git zsh-completions zsh-autosuggestions zsh-syntax-highlighting)
安裝incr補全插件
wget http://mimosa-pudica.net/src/incr-0.2.zsh mkdir ~/.oh-my-zsh/plugins/incr mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr echo 'source ~/.oh-my-zsh/plugins/incr/incr*.zsh' >> ~/.zshrc source ~/.zshrc
在~/.zshrc
中找到plugins
關鍵字,就能夠自定義啓用的插件了,系統默認加載git
。
命令內容能夠參考cat ~/.oh-my-zsh/plugins/git/git.plugin.zsh
。
經常使用的:
gapa git add --patch gc! git commit -v --amend gcl git clone --recursive gclean git reset --hard && git clean -dfx gcm git checkout master gcmsg git commit -m gco git checkout gd git diff gdca git diff --cached gp git push grbc git rebase --continue gst git status gup git pull --rebase
完整列表:https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git
配置私鑰
# ssh key path export SSH_KEY_PATH="~/.ssh/rsa_id"
也能夠不配置環境變量就能夠
解壓文件用的,全部的壓縮文件,均可以直接x filename
,不用記憶參數
固然,若是你想要用tar
命令,能夠使用tar -
加tab
鍵,zsh會列出參數的含義。
sudo apt-get install autojump
j -stat
:能夠查看歷史路徑庫git-open插件能夠在你git項目下打開遠程倉庫瀏覽項目。
git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
$ source ~/.zshrc [oh-my-zsh] Insecure completion-dependent directories detected: drwxrwxrwx 1 qhong qhong 512 Jun 28 13:18 /home/qhong/.oh-my-zsh/custom/plugins/zsh-autosuggestions [oh-my-zsh] For safety, we will not load completions from these directories until [oh-my-zsh] you fix their permissions and ownership and restart zsh. [oh-my-zsh] See the above list for directories with group or other writability. [oh-my-zsh] To fix your permissions you can do so by disabling [oh-my-zsh] the write permission of "group" and "others" and making sure that the [oh-my-zsh] owner of these directories is either root or your current user. [oh-my-zsh] The following command may help: [oh-my-zsh] compaudit | xargs chmod g-w,o-w [oh-my-zsh] If the above didn't help or you want to skip the verification of [oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to [oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
要賦予執行權限
chmod 755 home/qhong/.oh-my-zsh/custom/plugins chmod 755 home/qhong/.oh-my-zsh/custom/plugins/zsh-autosuggestions
.zshrc中加入如下行
$ vim ~/.zshrc # 歷史命令日期顯示格式 HIST_STAMPS="yyyy-mm-dd" source ~/.zshrc
若是沒用oh my zsh的話可用以下alias
$ alias history='fc -il 1'
設置自動更新oh-my-zsh
默認狀況下,當oh-my-zsh有更新時,都會給你提示。若是但願讓oh-my-zsh自動更新,在~/.zshrc 中添加下面這句
DISABLE_UPDATE_PROMPT=true or # 自動更新的時間間隔,單位是天,這裏設置 30 天更新一次 export UPDATE_ZSH_DAYS=1
取消自動升級
DISABLE_AUTO_UPDATE=true
要手動更新,能夠執行
$ upgrade_oh_my_zsh
uninstall_oh_my_zsh
cd
命令了。在你知道路徑的狀況下,好比 /usr/local/bin
你能夠輸入cd /u/l/b
而後按進行補全快速輸入kill <tab>
就會列出全部的進程名和對應的進程號ls -l **/*.sh
,能夠遞歸顯示當前目錄下的 shell 文件,文件少時能夠代替 find
。使用 **/
來遞歸搜索setopt HIST_IGNORE_DUPS
能夠消除重複記錄,也能夠利用sort -t ";" -k 2 -u ~/.zsh_history | sort -o ~/.zsh_history
手動清除一、更新軟件包列表:
sudo apt-get update
二、安裝openjdk-8-jdk:
sudo apt-get install openjdk-8-jdk
三、查看java版本,看看是否安裝成功:
java -version
查看安裝路徑
$ sudo update-alternatives --config java There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure.
設置環境變量
#set jdk environment export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
移動安裝包到指定位置
$ sudo mv apache-maven-3.6.1-bin.tar.gz /usr/local/
解壓
$ sudo tar -zxvf apache-maven-3.6.1-bin.tar.gz $ sudo rm -rf apache-maven-3.6.1-bin.tar.gz
設置環境變量
export M2_HOME=/usr/local/apache-maven-3.6.1 export PATH=${M2_HOME}/bin:$PATH
查看
$ mvn -v Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00) Maven home: /usr/local/apache-maven-3.6.1 Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.4.0-18362-microsoft", arch: "amd64", family: "unix"
移動安裝包
$ sudo mv apache-tomcat-8.5.42.tar.gz /usr/local/
解壓
$ sudo tar -zxvf apache-tomcat-8.5.42.tar.gz $ sudo rm -rf apache-tomcat-8.5.42.tar.gz
設置環境變量
export TOMCAT_HOME=/usr/local/apache-tomcat-8.5.42 export PATH=${TOMCAT_HOME}/bin:$PATH
export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 alias cls='clear' alias ll='ls -l' alias la='ls -a' alias vi='vim' alias javac="javac -J-Dfile.encoding=utf8" alias grep="grep --color=auto" alias -s html=mate # 在命令行直接輸入後綴爲 html 的文件名,會在 TextMate 中打開 alias -s rb=mate # 在命令行直接輸入 ruby 文件,會在 TextMate 中打開 alias -s py=vi # 在命令行直接輸入 python 文件,會用 vim 中打開,如下相似 alias -s js=vi alias -s c=vi alias -s java=vi alias -s txt=vi alias -s gz='tar -xzvf' alias -s tgz='tar -xzvf' alias -s zip='unzip' alias -s bz2='tar -xjvf' #set jdk environment export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH export M2_HOME=/usr/local/apache-maven-3.6.1 export PATH=${M2_HOME}/bin:$PATH alias mccm=mvn clean compile -Dmaven.test.skip=true alias mcpm=mvn clean package -Dmaven.test.skip=true alias mcim=mvn clean install -Dmaven.test.skip=true alias mccs=mvn clean compile -DskipTests alias mcps=mvn clean package -DskipTests alias mcis=mvn clean install -DskipTests alias mdt=mvn dependency:tree alias mdtv=mvn dependency:tree -Dverbose alias mdti=mvn dependency:tree -Dincludes= alias mdte=mvn dependency:tree -Dexcludes= alias mdtvi=mvn dependency:tree -Dverbose -Dincludes=$* alias mdtve=mvn dependency:tree -Dverbose -Dexcludes= alias mdp=mvn dependency:purge-local-repository alias mdpi=mvn dependency:purge-local-repository -Dincludes= alias mdpe=mvn dependency:purge-local-repository -Dexcludes= alias mdpa=mvn dependency:purge-local-repository -DactTransitively=false alias mdpai=mvn dependency:purge-local-repository -DactTransitively=false -Dincludes= alias mdpae=mvn dependency:purge-local-repository -DactTransitively=false -Dexcludes= alias mdpr=mvn dependency:purge-local-repository -DreResolve=false alias mdpri=mvn dependency:purge-local-repository -DreResolve=false -Dincludes= alias mdpre=mvn dependency:purge-local-repository -DreResolve=false -Dexcludes= alias mdpar=mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false alias mdparf=mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false --fail-at-end alias mdpari=mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false -Dincludes= alias mdpare=mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false -Dexcludes= alias mdparm=mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false -DmanualIncludes=
Windows Subsystem for Linux 環境配置 (最新 1709 版)
WSL+cmder+oh-my-zsh美化win10命令工具(terminal)