歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> LINUX shell 快捷鍵

LINUX shell 快捷鍵

日期:2017/3/3 11:42:52   编辑:SHELL編程

刪除

ctrl + d 刪除光標所在位置上的字符相當於VIM裡x或者dl

ctrl + h 刪除光標所在位置前的字符相當於VIM裡hx或者dh

ctrl + k 刪除光標後面所有字符相當於VIM裡d shift+$ctrl + u 刪除光標前面所有字符相當於VIM裡d shift+^

ctrl + w 刪除光標前一個單詞相當於VIM裡db

ctrl + y 恢復ctrl+u上次執行時刪除的字符

ctrl + ? 撤消前一次輸入

alt + r 撤消前一次動作

alt + d 刪除光標所在位置的後單詞

移動

ctrl + a 將光標移動到命令行開頭相當於VIM裡shift+^

ctrl + e 將光標移動到命令行結尾處相當於VIM裡shift+$

ctrl + f 光標向後移動一個字符相當於VIM裡l

ctrl + b 光標向前移動一個字符相當於VIM裡h

ctrl + 方向鍵左鍵 光標移動到前一個單詞開頭

ctrl + 方向鍵右鍵 光標移動到後一個單詞結尾

ctrl + x 在上次光標所在字符和當前光標所在字符之間跳轉

alt + f 跳到光標所在位置單詞尾部

替換

ctrl + t 將光標當前字符與前面一個字符替換

alt + t 交換兩個光標當前所處位置單詞和光標前一個單詞

alt + u 把光標當前位置單詞變為大寫

alt + l 把光標當前位置單詞變為小寫

alt + c 把光標當前位置單詞頭一個字母變為大寫

^oldstr^newstr 替換前一次命令中字符串

歷史命令編輯

ctrl + p 返回上一次輸入命令字符

ctrl + r 輸入單詞搜索歷史命令

alt + p 輸入字符查找與字符相接近的歷史命令

alt + > 返回上一次執行命令

其它

ctrl + s 鎖住終端

ctrl + q 解鎖終端

ctrl + l 清屏相當於命令clear

ctrl + c 另起一行

ctrl + i 類似TAB健補全功能

ctrl + o 重復執行命令

alt + 數字鍵 操作的次數

實際操作:

#c+l 清屏先

minuit@suse:~>str1 str2 str3 #輸入三個單詞發現第一單詞需要大寫好按c+a跳到開頭按a+c

minuit@suse:~> Str1 str2 str3 #好現在單詞就變成了現在這個樣子,又發現第二個單詞要全大寫(這樣的命令真是玩死人:( )好吧如果你當前光標在第二個單詞,那直接a+u把這個單詞改變,如果不在的話那按住c+a接著c+f跳到第二個單詞那再a+u就OK了結果像下面所示。minuit@suse:~> Str1 STR2 str3 #我想換過來怎麼辦我的位置已經在最後一個單詞這個好辦按住a+2+b哈哈跳到了第二個單詞再來一下a+l這下第二個單詞全小寫了

minuit@suse:~> welcome to chinaunix! #不就是變個大小寫嗎? 按住c+a接著a+3+c看看效果

minuit@suse:~> Welcome To Chinaunix! #GOOD很簡單

我們再來試試替換

minuit@suse:~> Welcome To Chinaunix! #還是這三單詞c+a跳到開頭再接著跳到第二個單詞那(因為a+t只能跟前一個單詞做替換所以不能在第一個單詞按a+t)按住a+t

minuit@suse:~> To Welcome Chinaunix! #現在成這樣子的了如果我用再按a+2+t那又變了一個樣

minuit@suse:~> Chinaunix! Welcome To #好了來一點比較常用的

minuit@suse:~>ls /tmp/ #看看下面有些什麼

file1 file2 file3 ..... ..

minuit@suse:~>^ls^cd #現在再又想進入目錄很簡單的健入替換命令就行了在命令很長時用這個替換可以省掉很多按a+b或a+f的時間

cd /tmp/

minuit@suse:/tmp> #進入了tmp目錄了

跳轉的命令就不試了大家自己體會試也看不見^_^ ------------------------------------------------------------------------------

Ctrl + a 可以快速切換到命令行開始處Ctrl + e 切換到命令行末尾

Ctrl + r 在歷史命令中查找

Ctrl + u 刪除光標所在位置之前的所有字符

Ctrl + k 刪除光標所在位置之後的所有字符

ctrl + w 刪除光標之前的一個單詞

Ctrl + d 結束當前輸入、退出shell

ctrl + s 可用來停留在當前屏 ctrl + q 恢復刷屏

ctrl + l 清屏

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 如果沒有配置好,這個就很管用了。

本文出自 “11625502” 博客,請務必保留此出處http://11635502.blog.51cto.com/11625502/1792954

Copyright © Linux教程網 All Rights Reserved