You are not logged in.

#1 2017-08-03 07:05:30

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Bash history lag [SOLVED]

Hello! I have one annoying problem on my arch installation: whenever I use terminal and scroll previously typed commands (with UP key) it starts to lag after 3-5 commands. Damn thing just stucks, I start hitting UP key furiously and after some seconds it goes again. I am not heavy terminal user (or experienced), but need it sometimes. Emulator is termite, wm is i3, but it happens to me in urxvt and openbox too. Didn't done any kind of bash configuration. Please help me.

Last edited by mooncactus (2017-08-03 09:57:16)

Offline

#2 2017-08-03 08:10:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Bash history lag [SOLVED]

Paste your .bashrc


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-08-03 08:18:13

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

Offline

#4 2017-08-03 08:27:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Bash history lag [SOLVED]

Well, it isn't that...

Does it happen in other terms (xterm, for instance)?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2017-08-03 08:36:56

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

Yes, just tried xterm, stuck on third command sad

Offline

#6 2017-08-03 08:42:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Bash history lag [SOLVED]

Does it happen in the TTY, or just X? You are going to have to narrow it down, to identify under what specific conditions it is reproducible, otherwise this will be a long thread with mostly guesses...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2017-08-03 08:47:31

robg
Member
Registered: 2015-03-05
Posts: 225

Re: Bash history lag [SOLVED]

Could you please post the output of `echo $HISTSIZE`?
Also, does the problem persist if

a) you don't start X? (i.e. try to access the history in a TTY.)
b) you run `mv .bash_history .bash_history_tmp`? (This will make sure that bash starts a fresh history file. To revert, run `rm .bash_history` and `mv .bash_history_tmp .bash_history`.)

Offline

#8 2017-08-03 08:59:09

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

Well, same thing with TTY.  I think it wasn't stuck so quick just after installation but happend always if I scroll far enough, and gets worse with time. Right now it sometimes stucks on second command! Reproducible always on arch, never saw it on other distros. Don't know what more to say, this strange problem hunts me down on arch. sad

Offline

#9 2017-08-03 09:02:11

dockland
Member
From: Sweden
Registered: 2015-06-06
Posts: 861

Re: Bash history lag [SOLVED]

Just for a check, can you run top or perhaps htop and see if any process are running high (long shot, i know)


I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.

Offline

#10 2017-08-03 09:05:24

robg
Member
Registered: 2015-03-05
Posts: 225

Re: Bash history lag [SOLVED]

robg wrote:

  Could you please post the output of `echo $HISTSIZE`?
  Also, does the problem persist if you run `mv .bash_history .bash_history_tmp`? (This will make sure that bash starts a fresh history file. To revert, run `rm .bash_history` and `mv .bash_history_tmp .bash_history`.)

Could you please answer those?

Offline

#11 2017-08-03 09:16:32

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

`echo $HISTSIZE` gives me 500. Tried to delete history file, entered something like 10 commands and experienced no lag scrolling them! So it seems problem in full history, but why it lags when full? And tried to boot without display manager in TTY, same lags...

Last edited by mooncactus (2017-08-03 09:20:06)

Offline

#12 2017-08-03 09:22:01

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

System installed on SSD, with no problems in other applications.

Offline

#13 2017-08-03 09:23:49

robg
Member
Registered: 2015-03-05
Posts: 225

Re: Bash history lag [SOLVED]

mooncactus wrote:

`echo $HISTSIZE` gives me 500.

That looks fine.

mooncactus wrote:

Tried to delete history file, entered something like 10 commands and experienced no lag scrolling them! So it seems problem in full history, but why it lags when full?

So it does appear to be an issue regarding the size of your history file.
One explanation might be an issue involving the size of your history file.
Unfortunately I am not familiar with how bash reads entries from .bash_history but why don't you try setting HISTFILESIZE to some reasonable value for now?

man bash wrote:

HISTFILESIZE - The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, if necessary, to contain no more than that number of lines by removing the oldest entries. The history file is also truncated to this size after writing it when a shell exits. If the value is 0, the history file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation. The shell sets the default value to the value of HISTSIZE after reading any startup files.

Last edited by robg (2017-08-03 09:28:06)

Offline

#14 2017-08-03 09:31:24

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

Will try that and report results after some use.

Offline

#15 2017-08-03 09:42:19

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Bash history lag [SOLVED]

A badly configured hosts file or nsswitch can cause trouble but I've never seen it cause trouble in a terminal or tty. How did you install arch?


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#16 2017-08-03 09:55:07

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

Well,  I can consider myself absolutely stupid! big_smile The thing is, I wrote some python code and run in terminal, and didn't even realize how much times I repeated same commands! The history file was full of them! So when I scroll, I saw the same command and thought it was stuck big_smile  I am terribly sorry for taking your time to think on this thread! Suppose all this situation deserves a good laugh.

Offline

#17 2017-08-03 10:27:09

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,723
Website

Re: Bash history lag [SOLVED]

Glad it was nothing serious.

You may want to look into the HISTCONTROL setting, particularly the "ignoredups" value. 'man bash' for details.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#18 2017-08-03 10:37:10

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

Thank you! Already done that, "ignoredumps" was exactly for my case smile

Offline

#19 2017-08-03 11:55:00

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,456

Re: Bash history lag [SOLVED]

mooncactus wrote:

...didn't even realize how much times I repeated same commands! The history file was full of them!.

I'm late to the party, but my life changed a long time ago when someone pointed out how you can use Ctrl-R in a Bash term, or "history-search-backward" more specifically, if you've changed modes or key bindings. Try it and you'll rarely need to scroll with the arrow keys again.

Offline

#20 2017-08-04 06:56:57

mooncactus
Member
Registered: 2017-04-14
Posts: 15

Re: Bash history lag [SOLVED]

Thanks for the tip! Great feature!

Offline

Board footer

Powered by FluxBB