使用oh-my-zsh美化你的终端
oh-my-zsh官网地址:https://ohmyz.sh/
Your terminal never felt this good before
一、查看系统shell信息
Linux的shell有很多种,可以使用以下命令查看:
[root@localhost ~]# cat /etc/shells /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/nologin
但是系统默认使用的是bash,可以使用下面的命令查看:
[root@localhost ~]# echo $SHELL /bin/bash
二、安装zsh
在使用oh-my-zsh的时候,首先需要安装zsh,从上面我们可以看出,Centos7的系统没有安装zsh,那么我们可以通过下面的命令来安装:
[root@localhost ~]# yum -y install zsh
安装完成后,重新查看:
[root@localhost ~]# cat /etc/shells /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/nologin /bin/zsh
最后一行已经有了zsh了。
系统默认为bash,这里我们需要切换shell为zsh:
[root@localhost ~]# chsh -s /bin/zsh Changing shell for root. Shell changed.
切换后,需要重启系统,reboot,重启完成后,再次查看当前的shell:
[root@localhost]~# echo $SHELL /bin/zsh
三、安装oh my zsh
oh-my-zsh的源码放在GitHub上,所以首先确保自己的系统已经安装了git,如果没有安装,可以使用下面的命令安装:
[root@localhost]~# yum install git
安装oh-my-zsh:
[root@localhost]~# wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
安装完成后,界面如下:
Cloning Oh My Zsh... Cloning into '/root/.oh-my-zsh'... remote: Enumerating objects: 947, done. remote: Counting objects: 100% (947/947), done. remote: Compressing objects: 100% (833/833), done. remote: Total 947 (delta 26), reused 765 (delta 18), pack-reused 0 Receiving objects: 100% (947/947), 620.51 KiB | 109.00 KiB/s, done. Resolving deltas: 100% (26/26), done. Looking for an existing zsh config... Using the Oh My Zsh template file and adding it to ~/.zshrc __ __ ____ / /_ ____ ___ __ __ ____ _____/ /_ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ / /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / \____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ /____/ ....is now installed! Please look over the ~/.zshrc file to select plugins, themes, and options. p.s. Follow us at https://twitter.com/ohmyzsh. p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.
安装过程中如果出现如下错误:
fatal: unable to access 'https://github.com/robbyrussell/oh-my-zsh.git/': Peer reports incompatible or unsupported protocol version. 可以执行下面的命令: [root@localhost]~# yum update nss curl
上面安装成功后,可以使用下面的命令是oh-my-zsh生效:
[root@localhost]~# source ~/.zshrc #下面就是生效后的信息 ➜ ~ ➜ ~ ➜ ~
默认情况下使用的主题为:
ZSH_THEME="robbyrussell"
还有很多其他的主题,主题地址:https://github.com/robbyrussell/oh-my-zsh/wiki/themes
这里我将主题修改为:
ZSH_THEME="dallas"
更新配置:
[root@localhost]~# source ~/.zshrc #下面为生效后的信息 {18-10-08 17:46}localhost:~ root# {18-10-08 17:46}localhost:~ root# {18-10-08 17:46}localhost:~ root#
四、自动补全插件(智能提示)
虽然上面使用oh-my-zsh美化了界面,但是linux的命令非常的多,还有就是目录下的文件名非常的多,如何能友好的智能提示和补全也是我们非常需要的功能。这里我们就需要安装一些插件了。这里有一个incr.zsh 补全插件:http://mimosa-pudica.net/zsh-incremental.html
1、首先我们在~/.oh-my-zsh/plugins/目录下创建incr目录来存放该插件
{18-10-08 18:39}localhost:~ root# mkdir ~/.oh-my-zsh/plugins/incr
2、将插件下载到上一步创建的目录下
{18-10-08 18:40}localhost:~ root# wget -P ~/.oh-my-zsh/plugins/incr http://mimosa-pudica.net/src/incr-0.2.zsh
3、在~/.zshrc最后一行添加如下内容:
source ~/.oh-my-zsh/plugins/incr/incr*.zsh
4、重新更新配置
{18-10-08 18:46}localhost:~ root# source ~/.zshrc
现在就可以使用智能补全功能了,但是可能在使用的过程中,如果使用vim的时候出现以下问题:
{18-10-08 17:44}localhost:~ root# vim ~/ _arguments:451: _vim_files: function definition file not found 解决方式,执行下面两条命令即可: {18-10-08 17:44}localhost:~ root# rm -rf ~/.zcompdump* {18-10-08 17:45}localhost:~ root# exec zsh
以上就是自己使用zsh、oh-my-zsh和智能补全插件的整个过程做以上记录,方面今后使用。
最近关注流媒体服务器来做网络直播,本想使用阿里云的流媒体服务器,由于费用的问题还是想能否自己搭建一个流媒体服务器供自己测试使用。果不其然,Nginx居然如此强大,可以用来做流媒体服务器。本文将具体介绍流媒体服务器的搭建过程和使用过程。
OpenCV-Python读取、显示和保存图片,主要介绍如下函数的使用:imread、imshow、imwrite。读取图片使用imread函数,注意:opencv读取图片,默认颜色通道是BGR,而不是RGB。使用imshow函数即可,第一个参数表示窗口名称,第二个参数就是要显示的图像。保存图片使用imwrite函数, 第一个参数为要保存的路径和名称,第二个参数为图片,最后一个参数为可选项。
有时候为了打包需要敲很多命令,实在比较麻烦,所以这里记录了如何通过shell脚本将这些命令全部集中起来,后面可以直接执行该脚本就把需要的所有命令跑完。
在做搜索列表分页的时候,需要分页后的页面跳转的url地址中包含搜索的参数,在Laravel中的如何处理呢?
php中的array_walk_recursive函数对数组中的每个成员递归地应用用户函数
快速生成表格
Electron页面跳转、浏览器打开链接和打开新窗口
在使用Git的过程中,不想每次都输入用户名和密码去拉取代码,所以就需要保存这些信息,那么既然有保存了,就必须有清除功能。
在Mac电脑中,如何对Git的用户名和密码进行修改呢?起初不懂Mac,所以整了很久,本文将记录如何对这个进行操作,以便后期使用。
Docker编译镜像出现:fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory问题