For RedHat Enterprise Linux
# show system locale
locale
# show system support locale
locale -a
# using utf-8 as system locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# support Asia fonts
sudo yum groupinstall Fonts
# check the listening ports and applications on Linux
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo nmap -sTU -O IP-address-Here
# restart docker services
sudo systemctl stop docker
sudo systemctl daemon-reload
sudo systemctl start docker
# start docker, need to wait few minutes
sudo systemctl restart docker
docker-compose start
# stop docker
docker-compose stop
# stop and clear changes
docker-compose down
docker system prune -f
# start with images
docker-compose up -d
# Re-Install
## cd <compose configure path>
docker-compose down
docker system prune -f
# docker rm -fv $(docker ps -qa)
docker rmi $(docker images -q)
docker-compose pull
docker-compose up -d
# Login docker with root
docker exec -u 0 -it <container id> bash
# Enable docker ssh
docker exec <container id> /usr/sbin/sshd
tmux 是一个多通道终端。 最大的好处是:
当运行tmux时,实际上会运行一个tmux service,保持session的运行。
tmux的提出的概念是 tmux / sessions * / windows + / panes + tmux可以管理多个sessions。 一个session有多个windows。 一个windows有多个panes。 每个pane是一个终端。
yum -y install tmux
prefix 是一个重要的概念。它是一个tmux的快捷键,默认是[ctrl + b]。 比如,退出tmux的命令是
tmux -detach
等价于 [ctrl + b, d]
~/.tmux.conf
# list command
tmux list-command
# list shortcut keys
tmux list-keys
command | shortcut key | meaning |
---|---|---|
tmux new-session -s [session name] | create an session | |
tmux attach-session -t [session name] | attach to an (or the only) session | |
tmux detach-session | prefix + d | detach with the current session |
tmux list-sessions | list all sessions | |
tmux kill-session -t [session name] | kill a session |
command | shortcut key | meaning |
---|---|---|
tmux list-windows | list all windows | |
tmux kill-window -t [window name] | prefix + & | kill a window |
command | shortcut key | meaning |
---|---|---|
tmux split-window | prefix + % | new a horizontal pane |
tmux split-window -v | prefix + " | new a vertical pane |
tmux rotate-window | prefix + C-o | rotate panes |
tmux select-pane -U | prefix + Up | select the up pane |
tmux select-pane -D | prefix + Down | select the down pane |
tmux select-pane -L | prefix + Left | select the left pane |
tmux select-pane -R | prefix + Right | select the right pane |
tmux resize-pane -U | prefix + C-Up | resize the up side |
tmux resize-pane -D | prefix + C-Down | resize the down side |
tmux resize-pane -L | prefix + C-Left | resize the left side |
tmux resize-pane -R | prefix + C-Right | resize the right side |
tmux list-panes | list all panes | |
tmux kill-pane -t [pane name] | prefix + x | kill a pane |
set -g @plugin 'tmux-plugins/tmux-resurrect'
Hit prefix + I to fetch the plugin and source it. You should now be able to use the plugin.
Key bindings prefix + Ctrl-s - save prefix + Ctrl-r - restore