Bash Shell 快速鍵的學習使用作者: Fenng | 可以轉載, 轉載時務必以超連結形式標明文章原始出處和作者資訊及著作權聲明
網址: http://www.dbanotes.net/techmemo/shell_shortcut.html
這篇 Bash Shell Shortcuts 的快速鍵總結的非常好。值得學習。下面內容大多數是拷貝粘貼與總結.
">CTRL 鍵相關的快速鍵:
Ctrl + a - Jump to the start of the lineCtrl + b - Move back a charCtrl + c - Terminate the command //用的最多了吧?Ctrl + d - Delete from under the cursorCtrl + e - Jump to the end of the lineCtrl + f - Move forward a charCtrl + k - Delete to EOLCtrl + l - Clear the screen //清屏,類似 clear 命令Ctrl + r - Search the history backwards //尋找曆史命令Ctrl + R - Search the history backwards with multi occurrenceCtrl + u - Delete backward from cursor // 密碼輸入錯誤的時候比較有用Ctrl + xx - Move between EOL and current cursor positionCtrl + x @ - Show possible hostname completions Ctrl + z - Suspend/ Stop the command補充:Ctrl + h - 刪除當前字元Ctrl + w - 刪除最後輸入的單詞
ALT 鍵相關的快速鍵:
平時很少用。有些和遠程登陸工具衝突。
Alt + < - Move to the first line in the historyAlt + > - Move to the last line in the historyAlt + ? - Show current completion listAlt + * - Insert all possible completionsAlt + / - Attempt to complete filenameAlt + . - Yank last argument to previous commandAlt + b - Move backwardAlt + c - Capitalize the wordAlt + d - Delete wordAlt + f - Move forwardAlt + l - Make word lowercaseAlt + n - Search the history forwards non-incrementalAlt + p - Search the history backwards non-incrementalAlt + r - Recall commandAlt + t - Move words aroundAlt + u - Make word uppercaseAlt + 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 - 交換游標前面的兩個單詞
很多來自GNU 的 readline 庫。另外一份總結也很好
記憶是所有技術人員的敵人。一次要把所有的都記住是不可能的。針對自己的使用習慣,對少數快速鍵反覆使用,短期內就會有效果。
你還知道那些好用的快速鍵 ? 補充一下 ?
--EOF--