Something About Terminal
Terminal is essential

Due to various kinds of network environment, some basic modification & improvement may be necessary applied to your terminal.
Note: This article is based on macOS.
1. Command Line Beautifier
1.1 iTerm2
1.2 Oh My Zsh
Pre-requisites: zsh, curl or wget, git
Option one
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Option two
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
1.3 powerlevel10k
In Oh My Zsh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Edit .zshrc
nano ~/.zshrc
Change theme
ZSH_THEME="powerlevel10k/powerlevel10k"
2. Keep SSH active
Many servers or firewalls will disconnect after a period of inactivity on the SSH connection, which is very inconvenient, so we need to find a way to keep the connection.
2.1 Modify server side settings
nano /etc/ssh/sshd_config
# Server sends a request to Client every 60 seconds, and then Client responds to keep the connection
ClientAliveInterval 60
# After the server sends a request, the client does not respond if the number of times reaches 10, then the connection is automatically disconnected. Under normal circumstances, the client will not fail to respond
ClientAliveCountMax 10
sudo systemctl restart sshd
2.2 Modify client side settings
nano /etc/ssh/ssh_config (or ~/.ssh/config)
TCPKeepAlive=yes
# Client sends a request to Server every 60 seconds, and then Server responds to keep the connection
ServerAliveInterval 60
# After the client sends a request, the server will automatically disconnect if the number of times that the server does not respond reaches 3, and under normal circumstances, the server will not fail to respond
ServerAliveCountMax 3
3. SSH Fast Open
nano ~/.ssh/config
Host example # customized name
HostName 1.2.3.4 # server ip
Port 22 # ssh port, default 22
User exampleuser # ssh username
IdentityFile ~/your/path/example.pem # key file path
4. Proxy
Assume your proxy server is ready, whether it’s socks or http protocol.
4.1 Bash (macOS default command line)
Modify user global profile
nano ~/.bash_profile
Add proxy server information at the end of the configuration file: (port may vary depending on your proxy server config)
# proxy
alias proxy='export all_proxy=socks5://127.0.0.1:1080'
alias unproxy='unset all_proxy'
Make the configuration effective
source ~/.bash_profile
4.2 ZSH (recommended command line)
Modify user global profile
nano ~/.zshrc
Add proxy server information at the end of the configuration file: (port may vary depending on your proxy server config)
# proxy
alias proxy='export all_proxy=socks5://127.0.0.1:1080'
alias unproxy='unset all_proxy'
Make the configuration effective
source ~/.zshrc
4.3 How To Use
Switch ON proxy: type proxy
Switch OFF proxy: type unproxy
Copyright statement: Unless otherwise stated, all articles on this blog adopt the CC BY-NC-SA 4.0 license agreement. For non-commercial reprints and citations, please indicate the author: Henry, and original article URL. For commercial reprints, please contact the author for authorization.