LoginSignup
5
6

More than 5 years have passed since last update.

Bashシェルのhistoryの保存件数を増やす

Last updated at Posted at 2018-06-01

概要

Bashシェルでhistoryコマンドを実行すると、ユーザーのコマンドの実行履歴が表示される。
その際の履歴の表示件数(履歴の保存件数)を変更する。

$ history
  1  ll
  2  cd -
  ...
  500   history

historyコマンドの実行結果はこんな感じ。
macだと、デフォルトで500件保存される模様。linuxだと1000件らしい。ディストリビューションにもよるかと思われる。
いずれにせよ、忘れたコマンドを呼び出したりするには少々心もとない。

環境

  • macOS Sierra 10.12.6

手順

今回は保存件数を100000件にしてみる。

  1. ~/.bashrcにHISTSIZE=100000を追記する
$ echo "HISTSIZE=100000" >> ~/.bashrc

これで保存件数が変更される。

5
6
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
5
6