0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【bash】ターミナルのコマンド履歴検索のショートカット"control + S"を有効にする

Last updated at Posted at 2020-12-13

bashのコマンド履歴を検索するショートカット

ショートカット 意味
ctrl - r コマンド履歴を逆順に検索する
ctrl - s コマンド履歴を順に検索する

この2つのショートカットは、bashのコマンド操作をするためにとても便利です。

ただ、"ctrl - s"の方は、 bashの初期設定ではコマンド実行結果を停止するショートカットに使われているため、コマンド履歴のショートカットとして使えない。

なので、"ctrl - s"をコマンド履歴のショートカットとして使うためには、コマンド実行結果を停止するショートカットを無効にする必要がある。
そのためのコマンドは、下のsttyコマンドです。

~ $ stty stop undef

そして、常にこの設定を有効化するためには、bashの設定ファイルの~/.bash_profileに上のコマンド1行を書けばできます。

(macOS)ターミナルでよく使うショートカット一覧
(macOS)bindでターミナルのショートカット一覧の確認、新規ショートカットの割り当て設定

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?