0
Centixels-MacBook-Pro:~ Centixel$ /* some command */
Centixels-MacBook-Pro:~ Centixel$ ./a.out
Centixels-MacBook-Pro:~ Centixel$ ./a.out
Centixels-MacBook-Pro:~ Centixel$ ./a.out
Centixels-MacBook-Pro:~ Centixel$ 

I want to be able to access /* some command */ in two upkey presses, rather than 4 or N upkey presses. Is this possible to implement in settings? I hate having to upkey a million times through repeat commands to access a previous command.

If this is a repeat question, please refer me, I was not sure how to ask the question. Thank you in advance for your help.

Centixels-MacBook-Pro:~ Centixel$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

Edit:

# .bashrc

User specific aliases and functions

. .alias alias ducks='du -cks * | sort -rn | head -15'

Source global definitions

if [ -f /etc/bashrc ]; then . /etc/bashrc fi

PATH=$PATH:/home/username/bin:/usr/local/homebrew export PATH export HISTCONTROL=ignoreboth:erasedups

This is my edited .bashrc file (in my home directory), and the changes seem to not have been enacted, I have restarted my terminal as well.

  • The HISTCONTROL variable in bash appears to do what you want. Ubuntu versions have been setting it to ignoreboth in ~/.bashrc for as long as I can remember. It looks like you are on MacOS instead? – zwets Nov 21 '20 at 19:59

1 Answers1

0

Add this to your .bashrc file:

export HISTCONTROL=ignoredups

According to bash manpage:

A value of ignoredups causes lines matching the previous history entry to not be saved.