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

Tracy avatar
By Tracy
at 2010-12-07T22:31

Table of Contents

想如何快速尋找,已經下過的指令。

不好意思,是一個很古老的問題。

我們知道在 shell 裡面,通常都會記憶已打過的指令,

甚至登出之後,還會紀錄到 .bash_history 像這一類的檔案裡面,

以便下一次登錄後可以使用。使用方式通常都是按 『向上』鍵,就可以一個一個找。

雖然 shell 操作介面都很快,不過一個一個找還是挺沒效率的。

------

請問:若我要找『我曾經下過的指令』並且『以 export 開始的指令』

請問如何操作?


--
Tags: Linux

All Comments

Catherine avatar
By Catherine
at 2010-12-11T05:17
grep export .bash_history 這樣?
Anonymous avatar
By Anonymous
at 2010-12-12T14:09
!export
Sierra Rose avatar
By Sierra Rose
at 2010-12-13T18:24
上面是會執行最近一次的export 指令,如果要執行更早之前的
export 指令可能要借助history
Ina avatar
By Ina
at 2010-12-17T10:53
ctrl+r (輸入export) (再按ctrl+r 選擇)
Skylar Davis avatar
By Skylar Davis
at 2010-12-19T08:44
egrep '^export' .bash_history
Ina avatar
By Ina
at 2010-12-22T14:24
cat .bash_history|grep export
Ula avatar
By Ula
at 2010-12-23T16:41
$ history | grep export # history 就是 bash history
Mary avatar
By Mary
at 2010-12-24T04:46
ctrl+r +1
Margaret avatar
By Margaret
at 2010-12-28T13:36
ctrl+r +1 超好用的
Ida avatar
By Ida
at 2010-12-30T12:46
linux 果然臥虎藏龍,這麼古老的問題,都這麼多人會。
Queena avatar
By Queena
at 2011-01-02T07:40
我只是在回 ptt 水球時按錯視窗發現的XD
Lauren avatar
By Lauren
at 2011-01-05T03:10
ctrl+r 再輸入e

ubuntu 限制 cpu 使用數

Hedda avatar
By Hedda
at 2010-12-07T20:23
想請問目前有一台四核的主機 想限制讓某程序只使用一顆cpu資源 目前只查到cpulimit 不過它好像是 只能限制cpu使用量 謝謝大家 - ...

急..sendmail設定問題

Ingrid avatar
By Ingrid
at 2010-12-07T20:06
裝好mail server跟dovecot 後 進行測試 收發mail都失敗 以下是部分 maillog Dec 7 03:49:19 localhost sendmail[5851]: oB7BnJtR005851: ruleset=check_rcpt, arg1=andlt;userat114. ...

linux make的錯誤訊息

Suhail Hany avatar
By Suhail Hany
at 2010-12-07T17:17
因為要安裝mono2.8.1 但是找不到他的rpm可以安裝 因此是下載原始檔下來編譯 在make之後卻出現以下錯誤 make: *** No targets specified and no makefile found. Stop. 想請問說是有缺少甚麼嗎 ...

subprocess的問題

Irma avatar
By Irma
at 2010-12-07T12:12
※ [本文轉錄自 Python 看板 #1C_BKF_O ] 作者: qweqweqweqwe (啪) 看板: Python 標題: [問題] subprocess的問題 時間: Mon Dec 6 18:03:56 2010 最近在寫一 .cgi 程式 在呼叫shell command的時候碰到了一 ...

光碟機不能使用

Wallis avatar
By Wallis
at 2010-12-06T15:44
※ 引述《ponnou ( )》之銘言: : 系統:Fedora core release 4 Version 1.3 : 原本以為是光碟機掛掉 : 目前 已換過新的光碟機 : 透過圖形介面 點選 光碟 : 但出現以下訊息 : 掛載錯誤 : 已選取的檔案系統裝載失敗 : ...