升级
$ upgrade_oh_my_zsh
启动测速
$ time /bin/zsh -i -c exit
$ for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done
测速原生bash 启动速度
$ for i in $(seq 1 10); do /usr/bin/time bash -i -c exit; done
zsh 的启动脚本
当默认 shell 为 zsh 时,且当开启一个新 tab 时(或者一台主机通过 SSH 登录本主机时),/etc/zprofile
、/etc/zshrc
和 ~/.zshrc
均会被执行 ,且执行顺序为:
- /etc/zprofile
- /etc/zshrc
- ~/.zshrc
当开启一个新 tab 时,
Last login: Sat Jun 13 11:46:23 on ttys006
execute /etc/zprofile
execute /etc/zshrc
execute ~/.zshrc
当一台主机通过 SSH 登录本主机时
$ ssh wei.shi@192.168.16.173
Last login: Sat Jun 13 11:54:43 2020
execute /etc/zprofile
execute /etc/zshrc
execute ~/.zshrc
~ $
当启用一个新zsh 进程时
$ zsh
execute /etc/zshrc
execute ~/.zshrc
$
Solution
将zsh 的启动脚本中耗时的命令移除,使用 alias
,在需要执行的时候,再去执行它们。
Reference
FEATURED TAGS
algorithm
algorithmproblem
architecturalpattern
architecture
aws
c#
cachesystem
codis
compile
concurrentcontrol
database
dataformat
datastructure
debug
design
designpattern
distributedsystem
django
docker
domain
engineering
freebsd
git
golang
grafana
hackintosh
hadoop
hardware
hexo
http
hugo
ios
iot
java
javaee
javascript
kafka
kubernetes
linux
linuxcommand
linuxio
lock
macos
markdown
microservices
mysql
nas
network
networkprogramming
nginx
node.js
npm
oop
openwrt
operatingsystem
padavan
performance
programming
prometheus
protobuf
python
redis
router
security
shell
software testing
spring
sql
systemdesign
truenas
ubuntu
vmware
vpn
windows
wmware
wordpress
xml
zookeeper