I was curious if there’s a setting to keep ~/.bash_history from recording identical commands. So if you type the same thing many times in a row inside a console (Konsole in my case) it doesn’t add an entry each time, only once until you type something different. This can cause it to fill up pretty quickly and require more scrolling up to find an older command.
In addition, I was wondering if I could disable the console in Dolphin from creating pointless entries. I noticed that whenever I press F4 in the file browser to show its console I get random commands like “cd” and “clear” logged there except they start with a space.
Add the following to
However, that will not ignore duplicates which are separated by another command. It’ll only ignore successive invocations of the same command. And, it also allows for commands that start with a space to be excluded from the shell history.
Works just as desired now, thank you! Adding the following to ~/.bashrc gives full control of all the relevant settings:
# History settings
There is also HISTIGNORE to remove certain commands from history. I have it like this
to ignore spam of “xdotool” from an app I use to control the mouse from my phone, and ls because why the ■■■■ would I want ls in my bash history
you can use:
history | grep
to search past commands, stop wasting time scrolling.
make an alias:
alias hg="history | grep"
then for example:
will show all the sudo you’ve done.
! then the number will execute
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.