請問如何尋找已用過, 特定的指令? - Linux

Liam avatar
By Liam
at 2010-12-10T13:01

Table of Contents

※ 引述《spinlock (Just Do It)》之銘言:
: 在 ~/.inputrc 中加入下面兩行
: control-p: history-search-backward
: control-n: history-search-forward
: 重登shell後
: bash> export [ctrl-p or ctrl-n]
: ctrl-p 上一個export開頭的指令
: ctrl-n 下一個export開頭的指令
: 用ctrl-r搜尋也會找到"內含"關鍵字的指令,
: 而ctrl-p或ctrl-n只會找到以關鍵字起始的的指令。
: 兩著功能不太一樣,不過都很好用。
: 若再加入下面這行切換至vi mode簡直如虎添翼,一整個生產力大增呀~
: set editing-mode vi
: 不過記得這行要加在~/.inputrc的最上面,
: 不然它會把ctrl-n和ctrl-p蓋掉。


感謝 spinlock 的資訊,小弟站在這肩膀上,搜尋 google

發現有人提到,在 bashrc 裡面放這個

bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

登出再登入後

bash> export [按向上鍵或向下鍵]

哇! 很直觀。

--
Tags: Linux

All Comments

Xanthe avatar
By Xanthe
at 2010-12-10T20:30
這個好用

gnuplotfortran

Dorothy avatar
By Dorothy
at 2010-12-09T20:52
請問有人會安裝嗎 我想要在fortran下跑gnuplot $ gmake f95 -shared fortranposix.f90 -o libfortranposix.so posixwrapper.o /usr/bin/ld: /tmp/ccczSEGW.o: relocation R_X86_64 ...

postfix+SASL被破解

Genevieve avatar
By Genevieve
at 2010-12-09T20:45
我從 mail.log 檔案裡,發現大量類似這樣的訊息: Dec 9 20:41:23 mail postfix/smtpd[6503]: 6CC3224014C: client=unknown[82.128.37.7], sasl_method=LOGIN, sasl_username=USER 我猜 ...

文字無法複製到Virtualbox中的ubuntu

James avatar
By James
at 2010-12-09T16:28
剛剛利用virtualbox安裝了ubuntu 10.10的版本, 但是安裝完之後(也安裝了Guest Additions), 卻發現我在 windows端複製文字要貼過去virtualbox的ubuntu卻無法貼過去, 檢查設定值的general中進階分項內共用剪貼簿的設定, 也有選擇雙向.... 不知道是 ...

當|bc也在指令中的時候 如何"echo"不換 …

Belly avatar
By Belly
at 2010-12-09T12:40
※ 引述《bbirthday (想念....)》之銘言: : 例如說 我有以下指令在script裡 : x=100 : echo and#34;scale=2; sqrt($x)/3and#34; |bc : echo and#34; dollarsand#34; 我是覺得既然你都用了變數,那就用的徹底一點 ...

當|bc也在指令中的時候 如何"echo"不換行?!

Edward Lewis avatar
By Edward Lewis
at 2010-12-09T10:53
例如說 我有以下指令在script裡 x=100 echo and#34;scale=2; sqrt($x)/3and#34; |bc echo and#34; dollarsand#34; 輸出會是 3.33 dollars 如果我想要這樣的輸出: 3.33 dollars 我應該怎麼做呢? 我試過 ...