Skip to main content

设置 Shell 默认启动 tmux

One min read

因为是 zsh 所以修改 vim source ~/.zshrc

if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
tmux at -t 0 || tmux new -s 0
fi

一个命令版本

echo -e "\n# Automatically start tmux session\nif command -v tmux &> /dev/null && [ -z \"\$TMUX\" ]; then\n    tmux attach-session -t 0 || tmux new-session -s 0\nfi\n# Automatically start tmux session end\n" >> ~/.zshrc
source ~/.zshrc

再也也不用担心长命令不敢关 terminal 啦~

Loading Comments...