MacBook Pro (16-inch, 2019) OS 11.4
iTerm2-3_1_5
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
brew install lrzsz
cd /usr/local/bin
# 创建两个文件
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 -E -e -b
sleep 1
echo
echo
echo \# Sent \-\> $FILE
fi
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" -e -b
sleep 1
echo
echo \# Received $FILE
fi
chmod +777 iterm2-*
标签
新建标签:command + t
关闭标签:command + w
切换标签:command + 数字 或者 command + 左右方向键
切换全屏:command + enter
查找:command + f
分屏
垂直分屏:command + d
水平分屏:command + shift + d
切换屏幕:command + option + 方向键 或者 command + [ 或 command + ]
查看历史命令:command + ;
查看剪贴板历史:command + shift + h
其他
清除当前行:ctrl + u 经常用
到行首:ctrl + a
到行尾:ctrl + e
前进后退:ctrl + f/b (相当于左右方向键)
上一条命令:ctrl + p
搜索命令历史:ctrl + r
删除当前光标的字符:ctrl + d
删除光标之前的字符:ctrl + h
删除光标之前的单词:ctrl + w
删除到文本末尾:ctrl + k
交换光标处文本:ctrl + t
清屏1:command + r
清屏2:ctrl + l
比较常用的几个
⌘ + 数字 在各 tab 标签直接来回切换
选择即复制 + 鼠标中键粘贴,这个很实用
⌘ + f 所查找的内容会被自动复制
⌘ + d 横着分屏 / ⌘ + shift + d 竖着分屏
⌘ + r = clear,而且只是换到新一屏,不会想 clear 一样创建一个空屏
ctrl + u 清空当前行,无论光标在什么位置
输入开头命令后 按 ⌘ + ;会自动列出输入过的命令
C+y 粘贴至光标后
C+r 搜索命令历史,这个较常用
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。