• 安装 zsh 软件包和 git
CentOS: yum -y install zsh git
Ubuntu:  sudo apt -y install zsh git
  • 克隆 oh-my-zsh
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
  • 复制 .zshrc,修改命令提示符样式
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
ZSH_THEME="ys"
  • 修改 shell 类型
chsh -s /bin/zsh
[root@localhost ~]# chsh -s /bin/zsh
bash: chsh: 未找到命令
[root@localhost ~]# dnf -q provides '*/chsh'
util-linux-user-2.32.1-22.el8.x86_64 : libuser based util-linux utilities
仓库        :base
匹配来源:
文件名    :/etc/pam.d/chsh
文件名    :/usr/bin/chsh
文件名    :/usr/share/bash-completion/completions/chsh

通过上诉内容可以判断出, 软件包在util-linux-user中, 执行下面的安装就顺利安装好了
[root@localhost ~]# dnf install util-linux-user -y
[root@localhost ~]# chsh -s /bin/zsh
正在更改 root 的 shell。
shell 已更改。

注意: xshell客户端复制SSH渠道依旧是看到的依旧是原样, 需要重新连接就是zsh的shell了

# 如果需要改回去
➜  ~ bash
[root@localhost ~]# chsh -s /bin/bash
正在更改 root 的 shell。
shell 已更改
[root@localhost ~]# chsh -s /bin/bash
  • 如果不想修改, 可以通过执行zsh进入
[root@localhost ~]# zsh
➜  ~ 
  • 测试一下
➜  ~ lll
zsh: command not found: lll
修改配置
vi ~/.zshrc
添加下面内容
function lll(){
    (ls -la)
}
重载配置
source ~/.zshrc
执行自定义命令测试
➜  ~ lll
总用量 15128
dr-xr-x---.  8 root root    4096 7月   8 00:22 .
dr-xr-xr-x. 19 root root     250 7月   7 21:39 ..
...
  • 常用docker方法
function docker-exec() {
    (docker-compose exec $* bash)
    }
#重启docker 容器 修改yml文件后重载
function docker-reload() {
  (docker-compose down && docker-compose up -d $*)
}
#启动docker
function docker-start() {
  (docker-compose start $*)
}
#重启docker
function docker-restart() {
  (docker-compose restart $*)
}
#移除当前docker
function docker-remove(){
  (docker-compose down $*)
}
#构建启动docker
function docker-up() {
  (docker-compose up -d $* )
}
function docker-log() {
  (docker-compose logs $* )
}
#删除当前容器
function docker-rm(){
   (docker stop $1 | docker rm $1)
}
function docker-into(){
    (docker exec -it $* /bin/bash)
}

标签: none

添加新评论