【CTRL 鍵】
Ctrl + a – Jump to the start of the line
Ctrl + b – Move back a char
Ctrl + c – Terminate the command //用的最多了吧?
Ctrl + d – Delete from under the cursor
Ctrl + e – Jump to the end of the line
Ctrl + f – Move forward a char
Ctrl + k – Delete to EOL
Ctrl + l – Clear the screen //清屏,類似 clear 指令
Ctrl + r – Search the history backwards //查找曆史指令
Ctrl + R – Search the history backwards with multi occurrence
Ctrl + u – Delete backward from cursor // 密碼輸入錯誤的時候比較有用
Ctrl + xx – Move between EOL and current cursor position
Ctrl + x @ – Show possible hostname completions
Ctrl + z – Suspend/ Stop the command
【補充:】
Ctrl + h – 删除目前字元
Ctrl + w – 删除最後輸入的單詞
【ALT 鍵】
平時很少用。有些和遠端登陸工具沖突。
Alt + < - Move to the first line in the history
Alt + > – Move to the last line in the history
Alt + ? – Show current completion list
Alt + * – Insert all possible completions
Alt + / – Attempt to complete filename
Alt + . – Yank last argument to previous command
Alt + b – Move backward
Alt + c – Capitalize the word
Alt + d – Delete word
Alt + f – Move forward
Alt + l – Make word lowercase
Alt + n – Search the history forwards non-incremental
Alt + p – Search the history backwards non-incremental
Alt + r – Recall command
Alt + t – Move words around
Alt + u – Make word uppercase
Alt + back-space – Delete backward from cursor
// SecureCRT 如果沒有配置好,這個就很管用了。
【其他特定的鍵綁定:】
輸入 bind -P 可以檢視所有的鍵盤綁定。這一系列我覺得更為實用。
Here “2T” means Press TAB twice
$ 2T – All available commands(common) //指令行補全,我認為是 Bash 最好用的一點
$ (string)2T – All available commands starting with (string)
$ /2T – Entire directory structure including Hidden one
$ ./2T – Only Sub Dirs inside including Hidden one
$ *2T – Only Sub Dirs inside without Hidden one
$ ~2T – All Present Users on system from “/etc/passwd” //第一次見到,很好用
$ $2T – All Sys variables //寫Shell腳本的時候很實用
$ @2T – Entries from “/etc/hosts” //第一次見到
$ =2T – Output like ls or dir //好像還不如 ls 快捷
Esc + T – 交換光标前面的兩個單詞
【指令行曆史】
history 顯示指令曆史清單
↑(Ctrl p) 顯示上一條指令
↓(Ctrl n) 顯示下一條指令
!num 執行指令曆史清單的第num條指令
!! 執行上一條指令
!?string? 執行含有string字元串的最新指令
Ctrl + r - 然後輸入若幹字元,開始向上搜尋包含該字元的指令,繼續按Ctrl r,搜尋上一條比對的指令
Ctrl + s - 與Ctrl + 類似,隻是正向檢索
Alt + < - 曆史清單第一項
Alt + > - 曆史清單最後一項
ls !$ 執行指令ls,并以上一條指令的參數為其參數
【指令行編輯】
Ctrl + u - 剪切指令行中光标所在處之前的所有字元(不包括自身)
Ctrl + k - 剪切指令行中光标所在處之後的所有字元(包括自身)
Ctrl + a - 移動到目前行的開頭
Ctrl + e - 移動到目前行的結尾
Ctrl + d - 删除光标所在處字元
Ctrl + h - 删除光标所在處前一個字元
Ctrl + y - 粘貼剛才所删除的字元
Ctrl + c - 删除整行
Ctrl + (x u) - 按住Ctrl的同時再先後按x和u,撤銷剛才的操作
Ctrl + w - 剪切光标所在處之前的一個詞(以空格、标點等為分隔符)
Alt + d - 剪切光标之後的詞
Ctrl + f - 光标向前移動一個字元,相當與->
Ctrl + b - 光标向後移動一個字元,相當與<-
Alt + f - 光标向前移動一個單詞
Alt + b - 光标向後移動一個單詞
Esc + f - 移動到目前單詞的結尾
Esc + b - 移動到目前單詞的開頭
Ctrl + t - 颠倒光标所在處及其之前的字元位置,并将光标移動到下一個字元
Alt + t - 交換目前與以前單詞的位置
Esc + t - 颠倒光标所在處及其相鄰單詞的位置
Alt + u - 把目前詞轉化為大寫
Alt + l - 把目前詞轉化為小寫
Alt + c - 把目前詞彙變成首字元大寫
Ctrl + v - 插入非凡字元,如Ctrl v Tab加入Tab字元鍵
alt + . — 插入最有輸入的指令。
alt + b — 光标移動到前一個單詞處。
Esc + w - 删除光标所在處之前的字元至其單詞尾(以空格、标點等為分隔符)
【控制】
Ctrl + l - 清屏
ctrl + c — 終止目前指令或程序。
ctrl + d — 終止shell。
ctrl + z — 将程序放入背景,可以用fg指令将放入背景的指令調入前台。
Ctrl + s - 挂起目前shell
Ctrl + q - 重新啟用挂起的shell
shell(bash)指令行快捷方式
本文轉自leonardos51CTO部落格,原文連結:http://blog.51cto.com/leomars/1712262 ,如需轉載請自行聯系原作者