之前一直在用zsh终端,然后安装oh-my-zsh,配置后感觉特别清爽,于是想bash终端下是否存在类似的软件,找了下发现了oh-my-bash。特记录下安装使用过程
oh my bash官网:https://ohmybash.nntoan.com/
oh my bash github:https://github.com/ohmybash/oh-my-bash
系统终端SHELL类型确认
# 查看当前shell类型
root@node01:~# echo $SHELL
/bin/bash
root@node01:~#
# 查看当前系统信息
root@node01:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
root@node01:~#
安装oh my bash
# 备份现有的.bashrc文件
root@node01:~# cp ~/.bashrc ~/.bashrc.orig
root@node01:~#
# 安装并应用 oh my bash
root@node01:~# bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
Cloning Oh My Bash...
$ git clone --depth=1 https://github.com/ohmybash/oh-my-bash.git /root/.oh-my-bash
Cloning into '/root/.oh-my-bash'...
remote: Enumerating objects: 490, done.
remote: Counting objects: 100% (490/490), done.
remote: Compressing objects: 100% (454/454), done.
remote: Total 490 (delta 26), reused 335 (delta 22), pack-reused 0 (from 0)
Receiving objects: 100% (490/490), 4.01 MiB | 5.72 MiB/s, done.
Resolving deltas: 100% (26/26), done.
Looking for an existing bash config...
Found ~/.bashrc. Backing up to /root/.bashrc.omb-backup-20241115113454
$ mv /root/.bashrc /root/.bashrc.omb-backup-20241115113454
Copying the Oh-My-Bash template file to ~/.bashrc
$ mv -f /root/.bashrc.omb-temp /root/.bashrc__ __ ______ / /_ ____ ___ __ __ / /_ ____ ______/ /_/ __ \/ __ \ / __ `__ \/ / / / / __ \/ __ `/ ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_/ / /_/ (__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /_.___/\__,_/____/_/ /_//____/ .... is now installed!
Please look over the ~/.bashrc file to select a theme, plugins, completions, aliases, and options
To keep up on the latest news and updates, follow us on GitHub: https://github.com/ohmybash/oh-my-bash
11:34:55 root@node01 ~ →
修改oh my bash主题
- 查看安装完成后默认存在的主题
# 查看当前存在的主题
11:36:03 root@node01 ~ → ls ~/.oh-my-bash/themes/
90210 font powerline-naked
THEMES.md gallifrey powerline-plain
absimple garo powerline-wizard
agnoster half-life primer
axin hawaii50 pro
bakke ht pure
binaryanomaly iterate purity
bobby kitsune pzq
bobby-python lambda rainbowbrite
brainy luan rana
brunton mairan rjorgenson
candy mbriggs robbyrussell
clean minimal roderik
cooperkid minimal-gh rr
cupcake modern sexy
demula modern-t simple
developer morris sirup
dos n0qorg slick
doubletime nwinkler standard
doubletime_multiline nwinkler_random_colors tonka
doubletime_multiline_pyonly pete tonotdo
dulcie powerbash10k tylenol
duru powerline vscode
edsonarios powerline-icon wanelo
emperor powerline-light zitron
envy powerline-multiline zork
11:36:08 root@node01 ~ →
- 修改oh my bash主题为robbyrussell,关键词为.bashrc内的OSH_THEME
# 修改当前注入为robbyrussell
11:39:02 root@node01 ~ → cat ~/.bashrc | grep "OSH_THEME"
#OSH_THEME="font"
OSH_THEME="robbyrussell"
# If you set OSH_THEME to "random", you can ignore themes you don't like.
11:39:12 root@node01 ~ →
- 加载修改后的.bashrc配置,使其生效
# 加载配置文件,使其生效
11:41:05 root@node01 ~ → source .bashrc➜ ~
➜ ~ uname -a
Linux node01.sec.lab 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
➜ ~