-
iTerm2 启用rz/sz
https://wsgzao.github.io/post/lrzsz/
➜ ~ brew install lrzsz
➜ ~ brew install axel
➜ ~ export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
➜ ~ vim iterm2-send-zmodem.sh
#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required
# Remainder of script public domain
osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
FILE=$(osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
else
FILE=$(osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
fi
if [[ $FILE = "" ]]; then
echo Cancelled.
# Send ZModem cancel
echo -e \\x18\\x18\\x18\\x18\\x18
sleep 1
echo
echo \# Cancelled transfer
else
/usr/local/bin/sz "$FILE" --escape --binary --bufsize 4096
sleep 1
echo
echo \# Received "$FILE"
fi
➜ ~ chmod +x iterm2-send-zmodem.sh
➜ ~ vim iterm2-recv-zmodem.sh
#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required
# Remainder of script public domain
osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
FILE=$(osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
else
FILE=$(osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
fi
if [[ $FILE = "" ]]; then
echo Cancelled.
# Send ZModem cancel
echo -e \\x18\\x18\\x18\\x18\\x18
sleep 1
echo
echo \# Cancelled transfer
else
cd "$FILE"
/usr/local/bin/rz --rename --escape --binary --bufsize 4096
sleep 1
echo
echo
echo \# Sent \-\> $FILE
fi
➜ ~ chmod +x iterm2-recv-zmodem.sh
➜ ~ sudo mv iterm2-* /usr/local/bin
点击 iTerm2 的设置界面 Perference-> Profiles -> Default -> Advanced -> Triggers 的 Edit 按钮,加入以下配置
添加两条 trigger,分别设置 Regular expression,Action,Parameters,Instant 如下:
Regular expression: rz waiting to receive.\*\*B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-send-zmodem.sh
Instant: checked
Regular expression: \*\*B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-recv-zmodem.sh
Instant: checked
[root@node2 ~]# rz -be
-
远程服务器使用本地代理
【远端】
vim /etc/ssh/sshd_config
GatewayPorts yes
service sshd reload
【本地】
➜ ~ ssh -Nf -R 33333:127.0.0.1:22 root@119.*.*.*
root@119.*.*.*'s password:
【远端】
[root@node2 ~]# netstat -antp | grep 33333
tcp 0 0 0.0.0.0:33333 0.0.0.0:* LISTEN 954134/sshd: root
tcp6 0 0 :::33333 :::* LISTEN 954134/sshd: root
export http_proxy=127.0.0.1:33333
#export ftp_proxy=192.168.13.226:10086
#export https_proxy=192.168.13.226:10086
[root@node2 ~]# export http_proxy=127.0.0.1:33333
[root@node2 ~]# echo $http_proxy
127.0.0.1:33333
[root@node2 ~]# git clone https://github.com/kubernetes/kops.git -v
-
本地免密ssh登录
【本机】
➜ ~ sudo vim /etc/hosts
119.*.*.* node2
➜ ~ ssh-keygen -t rsa
➜ ~ ls -alhi .ssh/*
➜ ~ cat .ssh/id_rsa.pub
【远程】
[root@node2 ~]# vim .ssh/authorized_keys
追加公钥
【本地】
➜ ~ ssh root@node2