bash - move faster
http://teohm.com/blog/shortcuts-to-move-faster-in-bash-command-line/
Shortcuts to move faster in Bash command line
Jan 4, 2012
Nowadays, I spend more time in Bash shell, typing longer commands. One of my new year resolutions for this year is to stop using left/right arrow keys to move around in the command line. I learned a few shortcuts a while ago.
Last night, I spent some time to read about “Command Line Editing” in the bash manual. The bash manual is a well-written piece of documentation. I think I should read it more often.
Well, here’s the new shortcuts I learned:
Basic moves
- Move back one character.
Ctrl
+b
- Move forward one character.
Ctrl
+f
- Delete current character.
Ctrl
+d
- Delete previous character.
Backspace
- Undo.
Ctrl
+-
Moving faster
- Move to the start of line.
Ctrl
+a
- Move to the end of line.
Ctrl
+e
- Move forward a word.
Meta
+f
(a word contains alphabets and digits, no symbols) - Move backward a word.
Meta
+b
- Clear the screen.
Ctrl
+l
What is Meta? Meta
is your Alt
key, normally. For Mac OSX user, you need to enable it yourself. Open Terminal > Preferences > Settings > Keyboard, and enable Use option as meta key. Meta
key, by convention, is used for operations on word.
Cut and paste (‘Kill and yank’ for old schoolers)
- Cut from cursor to the end of line.
Ctrl
+k
- Cut from cursor to the end of word.
Meta
+d
- Cut from cursor to the start of word.
Meta
+Backspace
- Cut from cursor to previous whitespace.
Ctrl
+w
- Paste the last cut text.
Ctrl
+y
- Loop through and paste previously cut text.
Meta
+y
(use it afterCtrl
+y
) - Loop through and paste the last argument of previous commands.
Meta
+.
Search the command history
- Search as you type.
Ctrl
+r
and type the search term; RepeatCtrl
+r
to loop through results. - Search the last remembered search term.
Ctrl
+r
twice. - End the search at current history entry.
Ctrl
+j
- Cancel the search and restore original line.
Ctrl
+g
Need more?
- A comprehensive bash editing mode cheatsheet by Peteris Krumin (catonmat.net).
- Vim users! Do you know you can switch to Vi-style editing mode? Here: vi-style cheatsheet.
- Bash command line editing is actually handled by GNU Readline Library. So just dive into Readline manual for everything else.
bash - move faster的更多相关文章
- [Bash] Move and Copy Files and Folders with Bash
In this lesson we’ll learn how to move and rename files (mv) and copy (cp) them. Move index.html to ...
- shell浅谈之十函数
转自:http://blog.csdn.net/taiyang1987912/article/details/39583179 一.简介 Linux Shell编 程中也会使用到函数,函数可以把大的命 ...
- iOS 学习 - 10下载(3) NSURLSession 音乐 篇
使用 NSURLSession 下载,需要注意的是文件下载文件之后会自动保存到一个临时目录,需要开发人员自己将此文件重新放到其他指定的目录中 // // ViewController.m // Web ...
- Deep Learning in a Nutshell: History and Training
Deep Learning in a Nutshell: History and Training This series of blog posts aims to provide an intui ...
- September 26th 2016 Week 40th Monday
The land didn't move, but moved. The sea wasn't still, yet was still. 大地止而亦行,大海动而亦静. Still waters ru ...
- 【HDU 3810】 Magina (01背包,优先队列优化,并查集)
Magina Problem Description Magina, also known as Anti-Mage, is a very cool hero in DotA (Defense of ...
- PhoenixFD插件流体模拟——UI布局【Gird】详解
流体网格 本文主要讲解Grid折叠栏中的内容 主要内容 Overview 综述 Parameters 参数 General 普通参数 Example: Scene Scale Example: Gri ...
- Robot Operating System (ROS)学习笔记3---键盘控制
搭建环境:XMWare Ubuntu14.04 ROS(indigo) 转载自古月居 转载连接:http://www.guyuehome.com/253 一.创建控制包 catkin_creat ...
- Five reasons phosphorene may be a new wonder material
A material that you may never have heard of could be paving the way for a new electronic revolution. ...
随机推荐
- C#异步编程的实现方式(4)——Task任务
最基本的是知道怎么启动一个Task. 1.Task类构造函数 使用Task类的构造函数.实例化Task对象时,任务不会立即运行,而是指定Created状态.接着调用Task类的Start()方法来启动 ...
- go timer
go timer package main import ( "fmt" "time" ) func debounce(interval time.Durati ...
- BZOJ3620: 似乎在梦中见过的样子(KMP)
Description “Madoka,不要相信 QB!”伴随着 Homura 的失望地喊叫,Madoka 与 QB 签订了契约. 这是 Modoka 的一个噩梦,也同时是上个轮回中所发生的事.为了使 ...
- ArcGIS小技巧——提取面要素的质心点
如下图,现在要做这样一件事,提取面图层中每一个图斑的质心点,然后使用质心点提取图层中的一个属性值,并在此基础上进行克里金插值,生成该属性的空间插值图.当然,今天这段文字主要简单说一下怎样提取面图层的质 ...
- Dubbo学习总结(4)——Dubbo基于Zookeeper实现分布式实例
入门实例解析 第一:provider-提供服务和相应的接口 创建DemoService接口 [java] view plaincopyprint? <span style="font- ...
- session应用二
从session中获取mapper对象,利用mapper对象进行增删改查 Date now = new Date(); SqlSession session = this.yangchebaoDbMa ...
- HDU 4869 Turn the pokers(思维+组合公式+高速幂)
pid=4869" target="_blank">Turn the pokers 大意:给出n次操作,给出m个扑克.然后给出n个操作的个数a[i],每一个a[i] ...
- 15、python学习手册之:python语句、赋值、表达式和打印
1.语句的另一个特殊规则是用一对括号把语句括起来就可以:括号().方括号[].字典的大括号{}.任何括在这些符号里的程序代码都可横跨好几行. 2.括号是可以包含一切的,因为任何表达式都可以包含在内,只 ...
- loadrunner11 +Win7 + 支持ie9,录制成功
loadrunner11 支持ie9,录制成功 中文例子: https://wenku.baidu.com/view/1123925377232f60ddcca149.html http://blog ...
- Netty系列之Netty可靠性分析--转载
原文地址:http://www.infoq.com/cn/articles/netty-reliability 1. 背景 1.1. 宕机的代价 1.1.1. 电信行业 毕马威国际(KPMG Inte ...