7

I'm facing a weird problem that I never had in 4 years using Ubuntu.

Commands in the terminal are running very slowly. A simple clear takes up to 20 seconds, as well as cd, get into vim, everything is really. Sometimes it even freezes the input to the point that I can't type anything for a long time.

I'm currently using Ubuntu 20.04.

I have no idea what could be causing this weird behavior. Can someone shed some light on it?

UPDATE: Htop screenshot

UPDATE 2:

htop screenshot CPU usage high

This shows the CPU usage on its way to 100%, and I found out that this behavior only happens in a specific git repository once I cd in it. I've run git status with some flags and it is using 100% CPU. But the diff is really small. Other git repos in my machine work fine.

joeljpa
  • 167

2 Answers2

5

I'm facing a weird problem that I never had in 4 years using in Ubuntu.

And more than two years later, I faced the exact same problem :') Same Ubuntu version.

It happened only in one of my project folders for me. htop showed high CPU usage. Every symptom you had checked out with me.

After some experimentation, I found out that in my case clearing my .bash_history fixed it. I further removed some customisation in my .bashrc to prevent it from happening in future.

I had PROMPT_COMMAND="history -a;$PROMPT_COMMAND" in my .bashrc because I wanted my history to instantly update after each run command in my shell (via Is it possible to make writing to .bash_history immediate?). Been using that for years but I removed that line. So my Bash history limit was also set to high and had been collecting everything since then.

I also suspect that duplicate entries were being put in it as well since that's the default. I then added the ignoredups in my rc file to disable duplicate entries. I'm assuming that large history + the .bashrc customisation didn't go well with my Git repo.

Numerous factors are probably at work here. I can only speculate what caused this weird behaviour being a novice but what I can confirm is that this solved my problem. I hope that offhand chance this fix can help someone else.

joeljpa
  • 167
-1

I had this problem and I tried many solutions available on the internet but nothing worked. but upgrating packages has solved problem quickly.

  1. sudo apt update
  2. sudo apt upgrade
  3. restart the terminal.

Thank you.