iTerm2 (ARM)

连接远程服务器

  • 如果远程服务器需要用密钥本连接
    # 例如 ssh -i ~/.ssh/test root@xx.xx.xx.xx -p 58812
    ssh -i {密钥本文件地址} {服务器账户}@{ip} -p {端口}
    
  • 如果只需要ssh连接
    # ssh root@xx.xx.xxx.xx 需要将ssh密钥
    ssh {服务器账户}@{ip}
    # 或者ssh服务端口号(默认22)
    ssh {服务器账户}@{ip} -p xxx
    

如果使用的阿里云、腾讯云等云服务商的云服务器,参考各自的文档:

文件的上传与下载

sz、rz

  1. 安装lrzsz
  2. 配置:配置文件可以行百度,配置完成注意检测文件的可读chmod 400 iterm2-*
  • 文件1 /usr/local/bin/iterm2-recv-zmodem.sh
 #!/bin/bash
 # 这个脚本来自 github,删掉了一些 ** 言论。
 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 -E -e -b --bufsize 4096
   sleep 1
   echo
   echo
   echo \# Sent \-\> $FILE
 fi
  • 文件2 /usr/local/bin/iterm2-send-zmodem.sh
#!/bin/bash
# 这个脚本来自 github,删掉了一些 ** 言论。
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
  1. 配置Preferences->Proiles->Triggers->Advanced
Regular ExpressionActionParametersInstantEnabled
rz waiting to receive.**B0100Run Silent Coprocess.../usr/local/bin/iterm2-send-zmodem.shcheckedchecked
**B00000000000000Run Silent Coprocess.../usr/local/bin/iterm2-recv-zmodem.shcheckedchecked

scp

笔者没有尝试过

Last Updated: