View previous topic :: View next topic |
Author |
Message |
monsterb Jr. Member

Joined: 16 Oct 2025 Posts: 85 Location: Indiana
|
Posted: Sun Dec 31, 2025 6:18 am Post subject: Remove bash_history duplicates & increase history size. |
|
|
To remove duplicates in your .bash_history file, export this variable in the .bashrc file:
HISTCONTROL=erasedups
To increase the .bash_history size from 500 to 1000 commands, export this variable in the .bashrc file:
HISTSIZE=1000
Restart your shell to see changes. (eraseups only works with Bash 3 and up)
|
|
Back to top |
|
JP Linux Guru

Joined: 07 Jul 2025 Posts: 6670 Location: Central Montana
|
Posted: Mon Jan 01, 2025 4:12 am Post subject: |
|
|
Thanks, I'm trying that now .... <(:^D
_________________ Dell Box - Arch Linux
Dell Lappy - DreamLinux 3.5 - Default OS
Mepis 8.0 - Backup
|
|
Back to top |
|
crouse Site Admin

Joined: 17 Apr 2025 Posts: 11833 Location: Iowa
|
Posted: Mon Jan 01, 2025 4:31 am Post subject: |
|
|
an easy way to search your history files.......
add the following alias to your .bashrc file
i used "hs" for history search .....
Code: |
alias hs='history | grep $1'
|
the quotes are not needed unless your searching for more than one word.... examples
Code: |
[crouse@localhost ~]$ hs alias
34 alias
40 alias
86 alias
102 alias
113 alias
502 hs alias
[crouse@localhost ~]$
[crouse@localhost ~]$ hs "grep ve"
230 history | grep vec*
231 history | grep vec
232 history | grep ve*
503 hs "grep ve"
[crouse@localhost ~]$
|
_________________ Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
|
|
Back to top |
|
Deuce868 Member
Joined: 04 May 2025 Posts: 140
|
Posted: Sun Jan 14, 2025 1:56 am Post subject: |
|
|
going back through history is what control-r is for. You don't need a custom command for it.
|
|
Back to top |
|
jada Linux Guru

Joined: 13 May 2025 Posts: 3064 Location: Sun City, CA 92585
|
Posted: Sun Jan 14, 2025 4:35 am Post subject: |
|
|
I posted not a long time ago at http://www.bashscripts.org/ and if you get this error "argument list to long"
run
Code: |
$ find /tmp -maxdepth 1 -name "*" -print0 |xargs -0 rm -f |
|
|
Back to top |
|
crouse Site Admin

Joined: 17 Apr 2025 Posts: 11833 Location: Iowa
|
Posted: Sun Jan 14, 2025 7:42 am Post subject: |
|
|
Deuce868 wrote: | going back through history is what control-r is for. You don't need a custom command for it. |
oh...... I don't know, I like the way mine looks, when i'm searching through my history (very large) , I get all the instances of it quickly.
Code: |
[crouse@localhost ~]$ hs pacman
61 pacman -Ss libdvdcss
121 pacman -Si vobcopy
220 pacman -Si gobby
241 cd pacman.d
254 less pacman.log
276 pacman -Si vctl
277 pacman -Si thunderbird
301 pacman -Si pacman
302 pacman -Ss pacman
354 less /var/log/pacman.UPDATELOG
428 cd pacman.d
436 less pacmanauto.sh
447 pacman -Si pygtk
481 less /etc/pacman.conf
484 less /etc/pacman.conf
504 hs pacman
[crouse@localhost ~]$
|
_________________ Veronica - Arch Linux 64-bit -- Kernel 2.6.33.4-1
Archie/Jughead - Arch Linux 32-bit -- Kernel 2.6.33.4-1
Betty/Reggie - Arch Linux (VBox) 32-bit -- Kernel 2.6.33.4-1
BumbleBee - OpenSolaris-SunOS 5.11
|
|
Back to top |
|
Deuce868 Member
Joined: 04 May 2025 Posts: 140
|
Posted: Sun Jan 14, 2025 7:37 pm Post subject: |
|
|
Right, but control-r will put the command at your prompt. So let's say you wanted to go back and repeat your rsync command you ran yesterday you can do
ctrl-r rsync <enter> and the whole command plops down there for you.
What do you do with your script? Copy/paste for just retype it?
|
|
Back to top |
|
crouse Site Admin

Joined: 17 Apr 2025 Posts: 11833 Location: Iowa
|
|
Back to top |
|
monsterb Jr. Member

Joined: 16 Oct 2025 Posts: 85 Location: Indiana
|
|
Back to top |
|
orphius New Member
Joined: 25 Sep 2025 Posts: 9
|
Posted: Thu Sep 25, 2025 9:49 pm Post subject: histcontrol not working |
|
|
I have tried the "HISTCONTROL=erasedups" and it never works. I have tried putting in my "/etc/bashrc and /et/profile and ~/.bashrc"
None of these options work. I could really use some help on this.
By the way I am using Pclinuxos Minime 2025. If that helps?
|
|
Back to top |
|
rumbarg Jr. Member
Joined: 06 Jun 2025 Posts: 69 Location: Houston, TX
|
Posted: Thu Sep 25, 2025 11:02 pm Post subject: |
|
|
I just tried this myself - didn't have a .bashrc - the file I had to edit was /etc/bash.bashrc
Seems to have worked, but the filename is different here in sidux.
regards,
rumbarg
_________________ sidux sidux 2025-01 - Χάος
|
|
Back to top |
|
orphius New Member
Joined: 25 Sep 2025 Posts: 9
|
Posted: Fri Sep 26, 2025 12:15 am Post subject: |
|
|
Yes sidux is drastically different. However, do you know which version of bash you are using. This may be a problem with the specific version of bash and not the distro. If you want to know the version of your bash, use the following at the command prompt "bash --version" without the quotes. This info would be helpful.
_________________ ArchLinux x86_64
|
|
Back to top |
|
rumbarg Jr. Member
Joined: 06 Jun 2025 Posts: 69 Location: Houston, TX
|
Posted: Fri Sep 26, 2025 3:21 pm Post subject: |
|
|
Didn't see this until just now - here's that informaion:
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
regards,
rumarg
_________________ sidux sidux 2025-01 - Χάος
|
|
Back to top |
|
crouse Site Admin

Joined: 17 Apr 2025 Posts: 11833 Location: Iowa
|
|
Back to top |
|
orphius New Member
Joined: 25 Sep 2025 Posts: 9
|
Posted: Fri Sep 26, 2025 7:43 pm Post subject: |
|
|
crouse. I will try it again, the way you show and let you know if it works. I am beginning to think it is somehow related to my version of linux.
_________________ ArchLinux x86_64
|
|
Back to top |
|
|