Skip to content

Commit e4ed050

Browse files
committed
Add post: install-zsh.md
1 parent ef9ba87 commit e4ed050

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed

content/posts/install-zsh.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
+++
2+
date = '2025-07-22T14:38:56+08:00'
3+
draft = false
4+
title = 'Install Zsh'
5+
+++
6+
7+
Zsh is almost best shell nowadays, because it has oh-my-zsh :). You can configure a theme, add useful plugins, such as zsh-syntax-highlighting and zsh-autosuggestions.
8+
9+
Here's a simple progress of installing zsh and configuring it.
10+
11+
## Step 1: Install Zsh
12+
13+
### On Ubuntu/Debian
14+
```bash
15+
sudo apt install zsh wget git -y
16+
```
17+
18+
### On macOS
19+
```bash
20+
brew install zsh wget git
21+
```
22+
23+
After installation, set Zsh as your default shell(or not, it will automatically change to zsh while installing oh-my-zsh):
24+
```bash
25+
chsh -s $(which zsh)
26+
```
27+
28+
Log out and log back in for the changes to take effect.
29+
30+
## Step 2: Install Oh-My-Zsh
31+
32+
Install Oh-My-Zsh using wget:
33+
34+
```bash
35+
# Using wget
36+
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
37+
```
38+
39+
## Step 3: Configure the 'ys' Theme
40+
41+
Edit your Zsh configuration file:
42+
```bash
43+
ZSH_THEME="ys"
44+
```
45+
46+
## Step 4: Install Plugins
47+
48+
### Install zsh-syntax-highlighting
49+
```bash
50+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
51+
```
52+
53+
### Install zsh-autosuggestions
54+
```bash
55+
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
56+
```
57+
58+
## Step 5: Enable Plugins
59+
60+
Edit your Zsh configuration again:
61+
```bash
62+
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
63+
```
64+
65+
Save and exit.
66+
67+
## Step 6: Apply Changes
68+
69+
Reload your Zsh configuration:
70+
```bash
71+
source ~/.zshrc
72+
# or
73+
exec zsh
74+
```
75+
76+
## Step 7: Verify Installation
77+
78+
Check that everything is working:
79+
```bash
80+
# Check Zsh version
81+
zsh --version
82+
83+
# Check Oh-My-Zsh
84+
omz version
85+
86+
# Verify plugins are working (should see colored syntax and suggestions)
87+
echo "This should show syntax highlighting" # Type slowly to see suggestions
88+
```
89+
90+
## Complete Installation Scripts
91+
92+
### For Ubuntu/Debian
93+
```bash
94+
sudo apt install zsh wget git -y
95+
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
96+
sed -i 's/robbyrussell/ys/' ~/.zshrc
97+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
98+
sed -i 's/^plugins=(/plugins=(zsh-syntax-highlighting /' ~/.zshrc
99+
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
100+
sed -i 's/^plugins=(/plugins=(zsh-autosuggestions /' ~/.zshrc
101+
```
102+
103+
### For macOS
104+
```bash
105+
brew install zsh wget git
106+
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
107+
sed -i "" 's/robbyrussell/ys/' ~/.zshrc
108+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
109+
sed -i "" 's/^plugins=(/plugins=(zsh-syntax-highlighting /' ~/.zshrc
110+
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
111+
sed -i "" 's/^plugins=(/plugins=(zsh-autosuggestions /' ~/.zshrc
112+
```
113+
114+
## Install other useful tools
115+
116+
### 1. fzf
117+
118+
```bash
119+
# Install
120+
brew install fzf
121+
122+
# Enable in Zsh
123+
echo '[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh' >> ~/.zshrc
124+
```
125+
126+
### 2. zoxide
127+
128+
```bash
129+
# Install
130+
brew install zoxide
131+
132+
# Enable in Zsh
133+
echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc
134+
```
135+
136+
### 3. lsd
137+
138+
```bash
139+
# Install
140+
brew install lsd
141+
142+
# Create aliases
143+
echo '\n' >> ~/.zshrc
144+
echo "alias ls='lsd'" >> ~/.zshrc
145+
echo "alias l='ls -l'" >> ~/.zshrc
146+
echo "alias la='ls -a'" >> ~/.zshrc
147+
echo "alias lla='ls -la'" >> ~/.zshrc
148+
echo "alias lt='ls --tree'" >> ~/.zshrc
149+
echo "alias ltr='ls -l --sort time'" >> ~/.zshrc
150+
```

0 commit comments

Comments
 (0)