Linux command line keyboard shortcuts

備份文件

cp install_collectd.log{,-old}

備份恢復(fù)

mv /etc/rc.conf{-old,}

重命名文件

mv /path/to/file.{txt,xml}

批量生成文件夾

mkdir myfolder{1,2,3}

光標(biāo)移動(dòng)到行首行尾

Ctrl+AandCtrl+E

刪除光標(biāo)前光標(biāo)后井联,刪除光標(biāo)前的單詞

Ctrl+U Ctrl+K Ctrl+W

搜索歷史命令

Ctrl+R

回到上次目錄

cd - ?

回到用戶目錄

cd ~

if you run a command that needs root privileges but forget to addsudoto the beginning, there's no need to retype the command. Just run:

sudo !!

if you want to run the last command that usedcat, you could just type:

!cat

If you just want to see what the lastcatcommand was, you can instead run:

!cat:p

say you had just created a folder using:

mkdir /new/awesome/folder

To thencdinto that directory, you could just type:

cd !$

Ctrl+LClear the screen

tabTab key autocomplete the name of command/file/directory etc. For eg. typetouand type tab

UP ARROW KeyShows you previous command in descending order

DOWN Arrow KeyWhen you are usingUP ARROW Keyto get previous command.Then try thisDOWN Arrow,it will show forward command history

Ctrl+RIt is for Reverse search.Press CTRL+R and type some command which you last run.It will search for last command you run.

Here we pressed CTRL+r then typed /etc ,it automatically searched for command

(reverse-i-search)`/etc': /etc/init.d/httpd restart

Ctrl+JIt end the CTRL+r search

Ctrl+GIt abort the search by CTRL+r ( and restores original line)

CTRL+pIt shows previous history,same like UP arrow key

CTRL+nIt shows forward history,same like DOWN arrow key

Ctrl+BMove cursor one character to the left side

Ctrl+FMove cursor one character to the right side

Ctrl+AMove cursor to start of the line

Ctrl+EMove cursor to end of the line

HOMEMove cursor at the start of the line

ENDMove cursor at the end of the line

CTRL+ RIGHT ARROWMove cursor one word right hand side

CTRL + RIGHT ARROWMove cursor one word left hand side

Ctrl+UIt cut everything from the line start to cursor

Ctrl+KIt cut everything from the cursor to end of the line

Ctrl+WIt cut the current word before the cursor

Ctrl+YIt paste the previous cut text

CTRL+kIt cut the line from the position of the cursor to the end of the line.

CTRL+SHIFT+cTo copy selected text

CTRL+SHIFT+vTo paste you last copied by CTRL+SHIFT+c

SHIFT + INSERTCopy selected text to clipboard and paste from the clipboard

Shift+PgUp/PgDown It Scrolls console buffer up/down. You can use this key, also in Runlevel 3 or terminal mode

CTRL+zPut the running process in background.(To get back, runjobscommand.And then foregorund it by usingfgcommand. )

For example. First run thetopthen press CTRL+z.After this use fg command and found job no. 1 for top. See below example

linux@tuxworld:~/Desktop$jobs[1]+Stoppedtoplinux@tuxworld:~/Desktop$fg%1

Ctrl + TIt swap the last two characters before the cursor

Esc + TIt swap the last two words before the cursor

CTRL+mIt is like a Enter key (If ENTER key do not work,try this)

And at the end….

Ctrl + DLog out of current session, likeexitcommand

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末亚脆,一起剝皮案震驚了整個(gè)濱河市秉继,隨后出現(xiàn)的幾起案子躏将,更是在濱河造成了極大的恐慌朴则,老刑警劉巖爽丹,帶你破解...
    沈念sama閱讀 219,270評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件勤篮,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡内地,警方通過(guò)查閱死者的電腦和手機(jī)伴澄,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,489評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)瓤鼻,“玉大人秉版,你說(shuō)我怎么就攤上這事贤重〔绲唬” “怎么了?”我有些...
    開(kāi)封第一講書人閱讀 165,630評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵并蝗,是天一觀的道長(zhǎng)祭犯。 經(jīng)常有香客問(wèn)我,道長(zhǎng)滚停,這世上最難降的妖魔是什么沃粗? 我笑而不...
    開(kāi)封第一講書人閱讀 58,906評(píng)論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮键畴,結(jié)果婚禮上最盅,老公的妹妹穿的比我還像新娘。我一直安慰自己起惕,他們只是感情好涡贱,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,928評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著惹想,像睡著了一般问词。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上嘀粱,一...
    開(kāi)封第一講書人閱讀 51,718評(píng)論 1 305
  • 那天激挪,我揣著相機(jī)與錄音,去河邊找鬼锋叨。 笑死垄分,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的娃磺。 我是一名探鬼主播薄湿,決...
    沈念sama閱讀 40,442評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了嘿般?” 一聲冷哼從身側(cè)響起段标,我...
    開(kāi)封第一講書人閱讀 39,345評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎炉奴,沒(méi)想到半個(gè)月后逼庞,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,802評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡瞻赶,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,984評(píng)論 3 337
  • 正文 我和宋清朗相戀三年赛糟,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片砸逊。...
    茶點(diǎn)故事閱讀 40,117評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡璧南,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出师逸,到底是詐尸還是另有隱情司倚,我是刑警寧澤,帶...
    沈念sama閱讀 35,810評(píng)論 5 346
  • 正文 年R本政府宣布篓像,位于F島的核電站动知,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏员辩。R本人自食惡果不足惜盒粮,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,462評(píng)論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望奠滑。 院中可真熱鬧丹皱,春花似錦、人聲如沸宋税。這莊子的主人今日做“春日...
    開(kāi)封第一講書人閱讀 32,011評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)弃甥。三九已至爽室,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間淆攻,已是汗流浹背阔墩。 一陣腳步聲響...
    開(kāi)封第一講書人閱讀 33,139評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留瓶珊,地道東北人啸箫。 一個(gè)月前我還...
    沈念sama閱讀 48,377評(píng)論 3 373
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像伞芹,于是被迫代替她去往敵國(guó)和親忘苛。 傳聞我的和親對(duì)象是個(gè)殘疾皇子蝉娜,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,060評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容