List of default Mac OS X command-line editing bash keyboard shortcuts

本文提供了一份详尽的 Mac OS X 中 Bash 命令行编辑快捷键列表,帮助用户提高工作效率。涵盖了光标移动、文本操作、历史记录搜索等功能,并指出部分快捷键同样适用于 Cocoa 文本框。

本文转载至:https://maymay.net/blog/2007/07/18/list-of-default-mac-os-x-command-line-editing-bash-keyboard-shortcuts/

More and more often I find myself doing my work on the command line because it’s faster and more efficient. However, most users find that they end up spending a lot of time typing and re-typing commands, editting them, and then having to fix them. This is especially true if you’re new to the command line.

In addition, many times you want to run multiple commands with only slight variations. Perhaps you are benchmarking your Web server with ApacheBench and want to change some of its settings. Whatever you are trying to do, many shells actually offer a full suite of command-line editting shortcuts.

Some of them are built into the shell itself and others are configured elsewhere. Unfortunately, different distributions and different operating systems sometimes don’t have the same shortcut configuration. There are lots of lists out there for Bash keyboard shortcuts for Linux, and many of these work on Mac OS X, but they don’t all work.

So here’s a list as complete as I can make it of the default keyboard editting shortcuts configured on a Mac OS X machine running bash. An extra goodie is that some of these movement shortcuts work in any Coacoa text field, which means you don’t have to keep switching between bash’s command line movement shortcuts and the +arrow keys shortcuts anymore.

CTRL+a
Move cursor to beginning of the line. (I think of this as  anchoring my cursor to the start.)
CTRL+e
Move cursor to the  end of the line.
CTRL+k
Delete everything from under the cursor to the end of the line. (I think of this as  killing the rest of my line.)
CTRL+f
Move  forward one character. Identical to  .
CTRL+b
Move  backward one character. Identical to  .
ESC+f
Move  forward one word.
ESC+b
Move  backward one word.
CTRL+u
Delete everything from under the cursor the beginning of the line.
CTRL+w
Delete from under the cursor to the beginning of the  word.
CTRL+r
Recall previous commands by searching for them.
CTRL+t
Transpose (swap) the two characters before the cursor with one another.
ESC+t
Transpose (swap) the two words before the cursor with one another.
CTRL+y
Paste the most previously-deleted string. Basically a sort of command-line editting “undo.”
CTRL+z
Stop the current process and send it to the background.
CTRL+c
Send an SIG_HUP to the current process. The net effect of doing this on the command line is that you  cancel your current command and are presented with a blank new line.
CTRL+d
Send an end-of-file special character to the current process. Doing this at the command line is identical to closing your terminal window.
CTRL+p
Recall previous command executed. Identical to  .
CTRL+d
Forward  delete.
CTRL+h
Backspace.
CTRL+j
Carriage return. Identical to hitting the  return key.
CTRL+m
Newline. Identical to  return.
CTRL+l
Repaint screen. This is useful if a program’s output is overwriting some text on your terminal. The effect of doing this on a command line is that you clear the screen. Note than in Apple’s Terminal.app, you can also press  +K to clear the screen.
CTRL-x + CTRL-x
Mark current location in line and jump to beginning of line or second mark if defined. Repeat to jump to between both marks.
CTRL+v
Insert next character  verbatim. This is how you escape control sequences. For instance, to literally send a
CTRL+[
Identical to  ESC.
ESC+c
Capitolize word under cursor and move to next word.
ESC+u
Uppercase word under cursor and move to next word.
ESC+l
Lowercase word under cursor and move to next word.
ESC+.
Insert last word from previous command after cursor.
TAB
Auto-completes file, folder, and program names.
ESC-?
List the possible completions
CTRL-x /
List the possible filename completions
ESC-/
Attempt filename completion
CTRL-x ~
List the possible variable completions
ESC- ~
Attempt username completion
CTRL-x $
List the possible variable completions
ESC-$
Attempt variable completion
CTRL-x @
List the possible hostname completion
ESC-@
Attempt hostname completion
CTRL-x !
List the possible command completions
ESC-!
Attempt command completion
ESC-TAB

Attempt completion from previous commands in the history list

Note that this list assumes you’ve not reconfigured any of these shortcuts. Again, they’re the default keyboard assignments. Furthermore, they’re the default keyboard assignments for the default command-line editting mode, which is emacs mode. If you’re familiar with the vi editor, you can change this to use all the cursor movement and deletion keys you’re familiar with by saying set -o vi to your shell.

External references

Here’s some other people’s lists. They’re basically the same, but what the hey.


"Mstar Bin Tool"是一款专门针对Mstar系列芯片开发的固件处理软件,主要用于智能电视及相关电子设备的系统维护与深度定制。该工具包特别标注了"LETV USB SCRIPT"模块,表明其对乐视品牌设备具有兼容性,能够通过USB通信协议执行固件读写操作。作为一款专业的固件编辑器,它允许技术人员对Mstar芯片的底层二进制文件进行解析、修改与重构,从而实现系统功能的调整、性能优化或故障修复。 工具包中的核心组件包括固件编译环境、设备通信脚本、操作界面及技术文档等。其中"letv_usb_script"是一套针对乐视设备的自动化操作程序,可指导用户完成固件烧录全过程。而"mstar_bin"模块则专门处理芯片的二进制数据文件,支持固件版本的升级、降级或个性化定制。工具采用7-Zip压缩格式封装,用户需先使用解压软件提取文件内容。 操作前需确认目标设备采用Mstar芯片架构并具备完好的USB接口。建议预先备份设备原始固件作为恢复保障。通过编辑器修改固件参数时,可调整系统配置、增删功能模块或修复已知缺陷。执行刷机操作时需严格遵循脚本指示的步骤顺序,保持设备供电稳定,避免中断导致硬件损坏。该工具适用于具备嵌入式系统知识的开发人员或高级用户,在进行设备定制化开发、系统调试或维护修复时使用。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值