一张图搞明白如何在命令行中快速移动光标

一张图搞明白如何在命令行中快速移动光标

 

 

命令解释:

part 1: 光标的移动

 

(1)Ctrl - A          # 移动到行首

(2)Ctrl - E          # 移动到行尾

 

(3)Alt -  B          # 移动到单词首部

(4)Alt  - F          # 移动到单词尾首 (ubuntu 1604 的终端下并未起作用)

         Esc - F          可以实现“移动到单词尾部”功能(用法:同时按下 Esc + F 键,若想多次执行,只可多次按下,不可按住 Esc 然后连续点击F)

 

(5)Ctrl - B          # 左移一个字符

(6)Ctrl - F          # 右移一个字符

 

part 2: 命令字符的删除

 

(1)Ctrl - U          # 删除(剪切)到行首

(2)Ctrl - K          # 删除(剪切)到行尾

 

(3)Ctrl - W         # 删除(剪切)到单词首部

(4)Alt  - D          # 删除(剪切)到单词尾首

 

(5)Ctrl + D         # 删除当前所在字符

(6)Ctrl + H         # 向左删除一个字符

 

part 3:  粘贴

 

 (1)Ctrl  + Y       # 粘贴最后一次剪切的字符串

 

注:(1) 空格和 / 都被当作“单词”的分隔符,这里的“单词” 只是连续的字符,并不是完整的单词。

       (2) “删除” 其实也是“剪切”。

 

 

也可参考PPT:https://talk.linuxtoy.org/cli-tips/#1

I’m tired of pounding on the arrow keys when moving in the command line, but I keep on forgetting the keyboard shorcuts that would help me move more efficiently, so here’s a simple diagram in a flashcard format for future reference!

I found a useful table with most of those in the How Linux Works book that I’m currently reading, and some more on Stack Overflow.

If you plan on using them, please bear in mind that these keyboard shorcuts depend on quite a number of things: the Unix distribution that you’re using, your shell, your own configuration quirks… so YMMV.

  • 原文 / From     twitter.com/linuxtoy/status/957225197928525824

 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值