Logo Ricky
  • Home
  • About
  • More
    Skills Experiences Education Projects
  • Posts
  • Notes
  • Activities
  • Transform
  • English
    English Chinese
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Tags
  • A10
  • ACME
  • AD
  • AES
  • AI
  • Aliyun
  • Ansible
  • APP
  • Application Delivery Controller
  • Arceus
  • Argo CD
  • ASCII
  • Authentication
  • Authorization
  • AWS
  • BASH
  • Bayonet
  • Benchmark
  • BGP
  • BIRD
  • Board Game
  • Browser
  • Byte
  • Cache
  • CDN
  • Channel
  • Chart
  • Checklist
  • Chrome
  • Chrome OS
  • Chrony
  • CI
  • Cilium
  • Cisco
  • Cloud-Native
  • Cloudflare
  • Cluster
  • Command Line
  • Completion
  • Config
  • Container
  • CPU
  • CURL
  • Data
  • Database
  • Debug
  • Dehydrated
  • Design
  • DevSecOps
  • Diagrams
  • Dmg
  • DNS
  • DNS-01
  • Docker
  • EFF
  • ElasticSearch
  • ELK
  • Emoji
  • EMQX
  • Encode
  • Encrypt
  • ESXi
  • Extension
  • Firewall
  • Fortigate
  • Fortinet
  • FortiOS
  • Game
  • GeoIP
  • GIN
  • Git
  • GitBook
  • Github
  • Gitlab
  • GitOps
  • Gluetun
  • Go
  • Go-Mysql-Elasticsearch
  • Golang
  • Google
  • GPG
  • GraphQL
  • HA
  • HAProxy
  • Hash
  • HomeLab
  • Htop
  • HTTP
  • Infra
  • Infrastructure
  • Input Method
  • Interview
  • Introduction
  • IPhone
  • Iptables
  • Iso
  • Issue
  • ITerm2
  • Jenkins
  • Jsoniter
  • Juniper
  • JWT
  • Kibana
  • Kubernetes
  • LDAP
  • Leetcode
  • Lightweight
  • Linkerd
  • Linux
  • LLM
  • Log
  • Lua
  • Lullaby
  • LVM
  • Machinelearning
  • MacOS
  • Markdown
  • Mattermost
  • Mermaid
  • MinIO
  • Module
  • MQTT
  • MSS
  • MTU
  • Music
  • MyDumper
  • MySQL
  • NAS
  • Netcat
  • Network
  • Nftables
  • Nginx
  • OAuth
  • OIDC
  • Ollama
  • OpenResty
  • Parquet
  • Percona
  • Pinyin
  • Pip
  • Plugin
  • Pokemon
  • PowerDNS
  • PowerShell
  • Pprof
  • Principle
  • Prometheus
  • Protobuf
  • Proxy
  • Push
  • Python
  • QRCode
  • R
  • RAID
  • RDP
  • Redis
  • Regex
  • Ringtone
  • Route
  • Rust
  • S3
  • ScreenShot
  • Security
  • Selenium
  • Sentry
  • Service Mesh
  • SFTP
  • SHELL
  • Slides
  • Snow
  • Software
  • SonarQube
  • SQL
  • SSH
  • SSL
  • String
  • Switch
  • Sync
  • Synology
  • System
  • Tcpdump
  • Telegram
  • Terminal
  • Terraform
  • Test
  • Testing
  • Time
  • Timeout
  • TLS
  • Tor
  • Trace
  • Traefik
  • Travel
  • Tunnel
  • Typora
  • Ubuntu
  • URL
  • UserAgent
  • V2Ray
  • Vagrant
  • Video
  • Vim
  • Virtualization
  • Visualization
  • VNC
  • VPN
  • VSCode
  • WAF
  • Web
  • WebAssembly
  • Webp
  • Windows
  • WSL
  • YAML
  • Youtube
  • Zabbix
  • Zero Trust
  • Zim
  • ZSH
  • 台語
Hero Image
zsh 配置文件解析及优先级

zsh 配置文件解析及优先级 zsh 的环境变量配置文件有: .zprofile .zlogin .zshrc .zshenv .zlogout .zshrc 就是用来对 Shell 整体做个性化配置的 .zprofile 和 .zlogin 差不多是一样的,他们都会被 login shells 设置环境变量,只是加载时间可能有一些差别。.zprofile 是基于 Bash 的 .bash_profile ,而 .zlogin 则是仿照 CSH 的 .login 遗留下来的名字 .zshrc 会设置 interactive shells 的环境变量。它会在 .zprofile 之后加载。通常可以设置 $PATH, $PROMPT, aliases, functions 等等。 .zshenv 总是会被读取,所以也可以在这里设置环境变量,$PATH 或 $EDITOR 等,但一般不怎么使用 zlogout 是在一个会话登出的时候被加载,非常适合用来清理临时的配置,比如重置终端窗口的标题 zsh 会在用户登录时(login shell)加载 ~/.zprofile zsh 会在开启新的终端会话时加载 ~/.zshrc 需要注意的是首先会加载 /etc/zshenv 下的内容, 然后再加载 HOME 目录下的配置文件: .zshenv → [.zprofile if login] → [.zshrc if interactive] → [.zlogin if login] → [.zlogout].

Monday, May 8, 2023 Read
Hero Image
Zsh tab-completion not working

Zsh tab-completion not working Question Although I’ve used Oh-My-Zsh in the past, I decided this time around (i.e. setting up a new computer) I’d try to avoid installing it to keep things a bit leaner. Right now I’m trying to cherry-pick Oh-My-Zsh’s insensitive tab-completion feature. Digging around its source repo, I found the following line: zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' I’m fairly confident this is the line Oh-My-Zsh executes to do what I want, so I tried adding it to my .zshrc. Restarted my terminal. Typed cd desk, then hit [tab]. No dice – I didn’t get cd Desktop/.

Friday, December 10, 2021 Read
Hero Image
超簡單!快速打造漂亮又好用的 zsh 終端環境

超簡單!快速打造漂亮又好用的 zsh 終端環境 用 zsh + zim + powerlevel10k 讓你的 Terminal 潮又快 打造 10X Engineer Shell 工作環境

Thursday, October 7, 2021 Read
Hero Image
我就感觉到快 —— zsh 和 oh my zsh 冷启动速度优化

我就感觉到快 —— zsh 和 oh my zsh 冷启动速度优化 Profiling # .zshrc zmodload zsh/zprof $ /bin/zsh $ zprof num calls time self name ----------------------------------------------------------------------------------- 1) 1 395.66 395.66 33.10% 395.59 395.59 33.09% _zsh_nvm_auto_use 2) 1 216.22 216.22 18.09% 216.13 216.13 18.08% nvm_die_on_prefix 3) 1 648.00 648.00 54.20% 168.85 168.85 14.12% nvm_auto 4) 2 479.15 239.57 40.08% 160.50 80.25 13.43% nvm 5) 1 102.30 102.30 8.56% 84.99 84.99 7.11% nvm_ensure_version_installed 6) 2 51.21 25.60 4.28% 29.55 14.78 2.47% compinit 7) 1 680.18 680.18 56.89% 22.17 22.17 1.85% _zsh_nvm_load 8) 2 21.66 10.83 1.81% 21.66 10.83 1.81% compaudit 9) 1 17.31 17.31 1.45% 17.31 17.31 1.45% nvm_is_version_installed 10) 193 17.43 0.09 1.46% 14.50 0.08 1.21% _zsh_autosuggest_bind_widget [Redacted] zprof 模块只能获取每个 zsh 函数的用时,因此适合找出拖累 zsh 冷启动的 oh my zsh 的插件。如果要获取完整的 .zshrc 性能分析,应该使用 xtrace。在 .zshrc 开头添加如下命令

Thursday, July 15, 2021 Read
Hero Image
ZSH 自动读取 macOS 系统代理配置并设置环境变量

ZSH 自动读取 macOS 系统代理配置并设置环境变量 $ system_profiler SPNetworkDataType # 获取完整网络配置信息 $ networksetup -listallnetworkservices # 列举所有网络设备 $ networksetup -getwebproxy Wi-Fi # 获取特定网络设备的系统代理配置 $ scutil --proxy # 获取当前已启用的代理配置,是对 system_profiler 的封装

Monday, January 11, 2021 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
Contact me:
  • zeyanlin@outlook.com
  • linzeyan
  • Ricky
  • Ricky