LoginSignup
0
1

More than 5 years have passed since last update.

bashのhistoryに連続して同じコマンドを記録しない

Posted at

これは

何回も同じコマンドを打った後に上矢印キーでコマンドを遡りたいときに連続して同じコマンドがhistoryに保存されていると遡るのが面倒なので解消。

作業

".bashrc"に追記

export HISTCONTROL=ignoreboth

追記前

$ ls -a
.     ..    file1 file2
$ ls
file1 file2
$ ls
file1 file2
$ history
...
  342  ls -a
  343  ls
  344  ls
  345  history

追記後

$ ls -a
.     ..    file1 file2
$ ls
file1 file2
$ ls
file1 file2
$ history
...
  354  ls -a
  355  ls
  356  history
0
1
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
1