Readline簡介 - Linux技術(shù)問答 - Linux中國 | Linux.cn - 我們的Linux中文社區(qū)
Readline簡介 [復(fù)制鏈接]
744 | 1
Readline 是一個(gè)強(qiáng)大的庫,只要使用了它的程序,都可以用同一個(gè)配置文件配置,而且用同樣的方法操作命令行,讓你可以方便的編輯命令行。
使用 readline 的程序現(xiàn)在主要有 Bash, GDB,ftp 等。readline 付予這些程序強(qiáng)大的 Emacs 似的命令行編輯方式,你可以隨意綁定你的鍵盤。
所有使用readline的程序,都使用一個(gè)配置文件來決定它的行為和鍵綁定。這個(gè)文件一般是 INPUTRC 環(huán)境變量確定的。如果這個(gè)環(huán)境變量沒有值,那么缺省使用 ~/.inputrc。
--------------------------------------------------------------------------------------------------------------------------------
方向 刪除
ctrl + k? ?? ?刪除光標(biāo)后面所有字符相當(dāng)于VIM里d shift+$
ctrl + u? ?? ?刪除光標(biāo)前面所有字符相當(dāng)于VIM里d shift+^
ctrl + w? ?? ?刪除光標(biāo)前一個(gè)單詞相當(dāng)于VIM里db
ctrl + y? ?? ?恢復(fù)ctrl+u上次執(zhí)行時(shí)刪除的字符
ctrl + r? ?? ? 輸入單詞搜索歷史命令
ctrl + s? ?? ?鎖住終端
ctrl + q? ?? ?解鎖終端
ctrl + l? ?? ???清屏相當(dāng)于命令clear
ctrl + ?? ?? ?撤消前一次輸入
PS:
CTRL 鍵相關(guān)的快捷鍵: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 // 密碼輸入錯(cuò)誤的時(shí)候比較有用
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
補(bǔ)充:
Ctrl + h - 刪除當(dāng)前字符
Ctrl + w - 刪除最后輸入的單詞
ALT 鍵相關(guān)的快捷鍵:
平時(shí)很少用。有些和遠(yuǎn)程登陸工具沖突。
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 如果沒有配置好,這個(gè)就很管用了。
其他特定的鍵綁定:
輸入 bind -P 可以查看所有的鍵盤綁定。這一系列我覺得更為實(shí)用。
Here "2T" means Press TAB twice
$ 2T - All available commands(common) //命令行補(bǔ)全,我認(rèn)為是 Bash 最好用的一點(diǎn)
$ (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腳本的時(shí)候很實(shí)用
$ @2T - Entries from "/etc/hosts"??//第一次見到
$ =2T - Output like ls or dir //好像還不如 ls 快捷
補(bǔ)充:
Esc + T - 交換光標(biāo)前面的兩個(gè)單詞
Readline簡介 - Linux技術(shù)問答 - Linux中國 | Linux.cn - 我們的Linux中文社區(qū)
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元

