ubuntu22.04 安装zsh及powerlevel10k主题环境配置

2023-10-25 11:10

本文主要是介绍ubuntu22.04 安装zsh及powerlevel10k主题环境配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

❤ 查看工作

1. 查看当前系统有哪些shell版本

cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/usr/bin/sh
/bin/dash
/usr/bin/dash

2. 查看当前使用的shell版本

echo @SHELL

❤ 安装ZShell

sudo apt-get -y install zshReading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:apg gnome-control-center-faces gnome-online-accounts libcolord-gtk1 libfreerdp-client2-2 libfreerdp-server2-2 libfreerdp2-2 libgnome-bg-4-1 libgsound0 libgssdp-1.2-0 libgupnp-1.2-1 libgupnp-av-1.0-3libgupnp-dlna-2.0-4 libmediaart-2.0-0 libncurses5 libntfs-3g89 librygel-core-2.6-2 librygel-db-2.6-2 librygel-renderer-2.6-2 librygel-server-2.6-2 libtinfo5 libvncserver1 libwinpr2-2mobile-broadband-provider-info network-manager-gnome python3-certifi python3-idna python3-macaroonbakery python3-nacl python3-protobuf python3-pymacaroons python3-requests python3-rfc3339 python3-tzpython3-urllib3 rygel
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:zsh-common
Suggested packages:zsh-doc
The following NEW packages will be installed:zsh zsh-common
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 4,794 kB of archives.
After this operation, 18.2 MB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu jammy/main amd64 zsh-common all 5.8.1-1 [3,985 kB]
Get:2 http://mirrors.aliyun.com/ubuntu jammy/main amd64 zsh amd64 5.8.1-1 [809 kB]                                                                                                                         
Fetched 4,794 kB in 35s (137 kB/s)                                                                                                                                                                         
Selecting previously unselected package zsh-common.
(Reading database ... 198435 files and directories currently installed.)
Preparing to unpack .../zsh-common_5.8.1-1_all.deb ...
Unpacking zsh-common (5.8.1-1) ...
Selecting previously unselected package zsh.
Preparing to unpack .../archives/zsh_5.8.1-1_amd64.deb ...
Unpacking zsh (5.8.1-1) ...
Setting up zsh-common (5.8.1-1) ...
Setting up zsh (5.8.1-1) ...
Processing triggers for man-db (2.10.2-1) ...

❤ 切换Zshell

 chsh -s /bin/zsh(非实时,需重启)

重启后再次打开终端显示:

This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.You can:(q)  Quit and do nothing.  The function will be run again next time.(0)  Exit, creating the file ~/.zshrc containing just a comment.That will prevent this function being run again.(1)  Continue to the main menu.(2)  Populate your ~/.zshrc with the configuration recommendedby the system administrator and exit (you will need to editthe file by hand, if so desired).

按键盘数字键 2,zshell 自动创建一个新的 ~/.zshrc 配置文件。

--- Type one of the keys in parentheses --- 2
/home/XXXX/.zshrc:15: scalar parameter HISTFILE created globally in function zsh-newuser-install
(eval):1: scalar parameter LS_COLORS created globally in function zsh-newuser-install

那么这个文件在哪里呢?它其实在用户的/home目录下面。

❤ zsh配置文件内容

此时的zshell缺少很多缩写命令,你可以在~/.zshrc中添加:

alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias vi='vim'
alias grep="grep --color=auto"

到此为止你的zsh就完全安装好。

❤ 安装oh-my-zsh

为了让zshell更加美观,安装oh-my-zsh。
Tips:
Q&A

terminal(http+socket5):
export https_proxy=http://+ip address:port 
export http_proxy=http://+ip address: port
export all_proxy=socks5://+ip address:port
cancel(http+socks):
unset https_proxy
unset http_proxy
unset all_proxy
look situation:
env | grep -i proxy
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

原来.zshrc更新成新的版本了。
再在里面添加:

alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias vi='vim'
alias grep="grep --color=auto"

❤ 安装powerlevel10k主题

1. Clone the repository:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

命令运行结果:

Cloning into '/home/XXXX/.oh-my-zsh/custom/themes/powerlevel10k'...
remote: Enumerating objects: 92, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 92 (delta 16), reused 51 (delta 10), pack-reused 0
Receiving objects: 100% (92/92), 343.45 KiB | 1.06 MiB/s, done.
Resolving deltas: 100% (16/16), done.

Gitee镜像:

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

2. 在.zshrc 文件中设置ZSH_THEME

Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

# sed -i 's/ZSH_THEME.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/g' .zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"

3. 重启命令行

source .zshrc

4. 设置P10k

STEP 1:命令进入p10k配置界面

p10k configure

STEP 2: 主题字体显示配置

请认准官网,谨防被骗
Hack Nerd Font字体下载
Hack Nerd Font 图片

  1. 将下载的Hack字体放到Ubuntu 20.04 的字体文件夹里面:
# 首先查看fonts配置文件夹路径
~ whereis fonts 
fonts: /etc/fonts /usr/share/fonts
~ cd ~/Downloads
~/Downloads mkdir Hack # 里面装着一系列字体版本
~/Downloads mv Hack /usr/share/fonts # 将文件移动到/usr/share/fonts文件中
  1. 右键将终端字体替换成Hack字体。

  2. 再重新通过p10k configure来进行配置。

STEP 3: 个性化P10k设置

第一个选择配置向导页面:

   This is Powerlevel10k configuration wizard. You are seeing it because you haven'tdefined any Powerlevel10k configuration options. It will ask you a few questions andconfigure your prompt.Does this look like a diamond (rotated square)?reference: https://graphemica.com/%E2%97%86--->    <---(y)  Yes.(n)  No.(q)  Quit and do nothing.Choice [ynq]: private choice is y

第二个选择配置向导页面:

                              Does this look like a lock?reference: https://fontawesome.com/icons/lock---><---(y)  Yes.(n)  No.(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [ynrq]: private choice is y

第三个选择配置向导页面:

                   Does this look like a Debian logo (swirl/spiral)?reference: https://debian.org/logos/openlogo-nd.svg---><---(y)  Yes.(n)  No.(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [ynrq]: private choice is y

第四个选择配置向导页面:

                      Do all these icons fit between the crosses?--->  XXXXXXXXX  <---(y)  Yes. Icons are very close to the crosses but there is no overlap.(n)  No. Some icons overlap neighbouring crosses.(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [ynrq]: private choice is n

第五个选择配置向导页面:

                                      Prompt Style(1)  Lean.~/src master                                                                      5s❯                                                                                   (2)  Classic.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(3)  Rainbow.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(4)  Pure.~/src master 5s                                                                     ❯                                                                                   (r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [1234rq]: private choice is 3

第六个选择配置向导页面:

                                     Character Set(1)  Unicode.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(2)  ASCII.~/src | master                                                                  5s >                                                                                   (r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [12rq]: private choice is 1

第七个选择配置向导页面:

                                      Prompt Color(1)  Lightest.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(2)  Light.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(3)  Dark.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(4)  Darkest.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [1234rq]: private choice is 4

第八个选择配置向导页面:

                                 Show current time?(1)  No.╭─ ~/src  master                                                            5s ─╮╰─                                                                                ─╯(2)  24-hour format.╭─ ~/src  master                                                 5s  16:23:42 ─╮╰─                                                                                ─╯(3)  12-hour format.╭─ ~/src  master                                              5s  04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [123rq]: private choice is 3

第九个选择配置向导页面:

                                   Prompt Separatorsseparator
(1)  Angled. //╭─ ~/src  master                                              5s  04:23:42 PM ─╮╰─                                                                                ─╯(2)  Vertical.╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(3)  Slanted.╭─ ~/src   master                                            5s   04:23:42 PM ─╮╰─                                                                                ─╯(4)  Round.╭─ ~/src  master                                              5s  04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [1234rq]: private choice is 2

第十个选择配置向导页面:

                                      Prompt Headshead
(1)  Sharp.         |v╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(2)  Blurred.╭─ ~/src │ master ▓▒░                                        ░▒▓ 5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(3)  Slanted.╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(4)  Round.╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [1234rq]: private choice is 1

第十一个选择配置向导页面:

                                      Prompt Tailstail
(1)  Flat.                                                                         |v╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(2)  Blurred.╭─░▒▓ ~/src │ master                                        5s │ 04:23:42 PM ▓▒░─╮╰─                                                                                ─╯(3)  Sharp.╭─ ~/src │ master                                            5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(4)  Slanted.╭─  ~/src │ master                                          5s │ 04:23:42 PM  ─╮╰─                                                                                ─╯(5)  Round.╭─ ~/src │ master                                            5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [12345rq]: private choice is 1

第十二个选择配置向导页面:

                                     Prompt Height(1)  One line.~/src │ master                                                  5s │ 04:23:42 PM (2)  Two lines.╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [12rq]: private choice is 2(1 是单行,比较习惯使用。)

第十三个选择配置向导页面:

                                   Prompt Connection(1)  Disconnected.╭─ ~/src │ master                                              5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(2)  Dotted.╭─ ~/src │ master ············································ 5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(3)  Solid.╭─ ~/src │ master ──────────────────────────────────────────── 5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [123rq]: private choice is 3

第十四个选择配置向导页面:

                                     Prompt Frame(1)  No frame.~/src │ master ──────────────────────────────────────────────── 5s │ 04:23:42 PM ❯                                                                                   (2)  Left.╭─ ~/src │ master ────────────────────────────────────────────── 5s │ 04:23:42 PM ╰─                                                                                  (3)  Right.~/src │ master ────────────────────────────────────────────── 5s │ 04:23:42 PM ─╮❯                                                                                 ─╯(4)  Full.╭─ ~/src │ master ──────────────────────────────────────────── 5s │ 04:23:42 PM ─╮╰─                                                                                ─╯(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [1234rq]: private choice is 1

第十五个选择配置向导页面:

                                     Prompt Spacing(1)  Compact.~/src │ master ──────────────────────────────────────────────── 5s │ 04:23:42 PM ❯                                                                                   ~/src │ master ──────────────────────────────────────────────── 5s │ 04:23:42 PM ❯                                                                                   (2)  Sparse.~/src │ master ──────────────────────────────────────────────── 5s │ 04:23:42 PM ❯                                                                                   ~/src │ master ──────────────────────────────────────────────── 5s │ 04:23:42 PM ❯                                                                                   (r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [12rq]: 
private choice is 1

第十六个选择配置向导页面:

                                         Icons(1)  Few icons.~/src │ master ──────────────────────────────────────────────── 5s │ 04:23:42 PM ❯                                                                                   (2)  Many icons.  │   ~/src │    master ───────────────────────────── 5s   │ 04:23:42 PM   ❯                                                                                   (r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [12rq]: private choice is 2

第十七个选择配置向导页面:

                                      Prompt Flow(1)  Concise.  │   ~/src │    master ───────────────────────────── 5s   │ 04:23:42 PM   ❯                                                                                   (2)  Fluent.  │   ~/src │ on    master ────────────────── took 5s   │ at 04:23:42 PM   ❯                                                                                   (r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [12rq]: private choice is 1

第十八个选择配置向导页面:

                               Enable Transient Prompt?(y)  Yes.❯ git pull❯ git branch x  │   ~/src │    master ───────────────────────────── 5s   │ 04:23:42 PM   ❯ git checkout x                                                                    (n)  No.  │   ~/src │    master ───────────────────────────── 5s   │ 04:23:42 PM   ❯ git pull                                                                            │   ~/src │    master ───────────────────────────── 5s   │ 04:23:42 PM   ❯ git branch x                                                                        │   ~/src │    master ───────────────────────────── 5s   │ 04:23:42 PM   ❯ git checkout x                                                                    (r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [ynrq]: private choice is n

第十九个选择配置向导页面:

                                  Instant Prompt Modehttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt(1)  Verbose (recommended).(2)  Quiet. Choose this if you've read and understood instant prompt documentation.(3)  Off. Choose this if you've tried instant prompt and found it incompatible with yourzsh configuration files.(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [123rq]: private choice is 1

第二十个选择配置向导页面:

                               Apply changes to ~/.zshrc?(y)  Yes (recommended).(n)  No. I know which changes to apply and will do it myself.(r)  Restart from the beginning.
(q)  Quit and do nothing.Choice [ynrq]: private choice is y

这篇关于ubuntu22.04 安装zsh及powerlevel10k主题环境配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/282163

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/

hadoop开启回收站配置

开启回收站功能,可以将删除的文件在不超时的情况下,恢复原数据,起到防止误删除、备份等作用。 开启回收站功能参数说明 (1)默认值fs.trash.interval = 0,0表示禁用回收站;其他值表示设置文件的存活时间。 (2)默认值fs.trash.checkpoint.interval = 0,检查回收站的间隔时间。如果该值为0,则该值设置和fs.trash.interval的参数值相等。

NameNode内存生产配置

Hadoop2.x 系列,配置 NameNode 内存 NameNode 内存默认 2000m ,如果服务器内存 4G , NameNode 内存可以配置 3g 。在 hadoop-env.sh 文件中配置如下。 HADOOP_NAMENODE_OPTS=-Xmx3072m Hadoop3.x 系列,配置 Nam

wolfSSL参数设置或配置项解释

1. wolfCrypt Only 解释:wolfCrypt是一个开源的、轻量级的、可移植的加密库,支持多种加密算法和协议。选择“wolfCrypt Only”意味着系统或应用将仅使用wolfCrypt库进行加密操作,而不依赖其他加密库。 2. DTLS Support 解释:DTLS(Datagram Transport Layer Security)是一种基于UDP的安全协议,提供类似于

Centos7安装JDK1.8保姆版

工欲善其事,必先利其器。这句话同样适用于学习Java编程。在开始Java的学习旅程之前,我们必须首先配置好适合的开发环境。 通过事先准备好这些工具和配置,我们可以避免在学习过程中遇到因环境问题导致的代码异常或错误。一个稳定、高效的开发环境能够让我们更加专注于代码的学习和编写,提升学习效率,减少不必要的困扰和挫折感。因此,在学习Java之初,投入一些时间和精力来配置好开发环境是非常值得的。这将为我

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

安装nodejs环境

本文介绍了如何通过nvm(NodeVersionManager)安装和管理Node.js及npm的不同版本,包括下载安装脚本、检查版本并安装特定版本的方法。 1、安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 2、查看nvm版本 nvm --version 3、安装