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+rand type the search term; RepeatCtrl+rto loop through results. - Search the last remembered search term.
Ctrl+rtwice. - 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. ...
随机推荐
- BZOJ2738: 矩阵乘法(整体二分)
Description 给你一个N*N的矩阵,不用算矩阵乘法,但是每次询问一个子矩形的第K小数. Input 第一行两个数N,Q,表示矩阵大小和询问组数: 接下来N行N列一共N*N个数,表示这个矩阵: ...
- 使用C#对XML进行增删改查操作
xml文件格式 <?xml version="1.0" encoding="utf-8"?> <messageList> <mes ...
- 洛谷 P3817 小A的糖果
P3817 小A的糖果 题目描述 小A有N个糖果盒,第i个盒中有a[i]颗糖果. 小A每次可以从其中一盒糖果中吃掉一颗,他想知道,要让任意两个相邻的盒子中加起来都只有x颗或以下的糖果,至少得吃掉几颗糖 ...
- Hi35xx NVR GDB调试
Hi35xx NVR GDB调试 1. 下载gdb源代码 嵌入式Linux 的GDB 调试环境由Host 和Target 两部分组成,Host 端使用arm-linuxgdb,Target Boa ...
- Express框架是什么
Express框架是什么 一.总结 1.express框架:基于node.js的web应用框架,可快速搭建一个完整功能的网站,丰富的HTTP工具以及来自Connect框架的中间件随取随用. 二.Exp ...
- libcurl 上传文件至 web服务器
测试环境搭建, 使用 wamp server (windows下的 apache+MySQL+php) libcurl vc6 工程代码 下载地址: http://download.csdn.ne ...
- Android RecyclerView嵌套RecyclerView
原理 RecyclerView嵌套RecyclerView的条目,项目中可能会经常有这样的需求,但是我们将子条目设置为RecyclerView之后,却显示不出来.自己试了很久,终于找到了原因:必须先设 ...
- c#中反射的用法(即如何根据字符找到已定义的变量)
2013-07-20 08:06 720人阅读 评论(0) 收藏 举报 分类: C#(9) 作者同类文章 X 版权声明:本文为博主原创文章,未经博主允许不得转载. 常常羡慕javascript中, ...
- python3 随机生成10以内的加法算术题
今晚晚饭过后,看到小孩在做加法题,全是10以内的,因为她现在只会10以内的加法题.而这些题是老婆手动出的题目. 看到这个情景,突然想到,可以用python来实现随机出题,而且可以指定出多少题,出多少以 ...
- 【 2017 Multi-University Training Contest - Team 9 && hdu 6162】Ch’s gift
[链接]h在这里写链接 [题意] 给你一棵树,每个节点上都有一个权值. 然后给你m个询问,每个询问(x,y,a,b); 表示询问x->y这条路径上权值在[a,b]范围内的节点的权值和. [题解] ...