简体   繁体   English

bash 选项卡自动完成太慢了

[英]bash tab auto-complete is too slow

my pc has trouble doing tab auto-completion.我的电脑无法自动完成选项卡。

Say, I want to find a file whose name starts from 'a'.比如说,我想找到一个名称以“a”开头的文件。 Then, I push the tab button like this.然后,我像这样按下标签按钮。

$ ls a<tab>

Then, it is stuck like 2~3 seconds:( It bothers so much..然后,它被卡住了 2~3 秒:( 太麻烦了..

Plus, there's a one thing that maybe you should know.另外,有一件事也许你应该知道。

Say agian, I want to find a file whose name starts from 'a'.说 agian,我想找到一个名称以“a”开头的文件。

If there is only one file whose name starts from a in pwd, it works very well.如果 pwd 中只有一个名称以a开头的文件,则效果很好。 I mean, there's no delay at all.我的意思是,根本没有延迟。

But if there's more than one file, it starts being stuck.但是如果有多个文件,它就会开始卡住。

And, I followed https://unix.stackexchange.com/a/185960 method to investigate this.而且,我按照https://unix.stackexchange.com/a/185960方法对此进行了调查。 But, when I push the tab button after set -x , it is stuck at the first place.但是,当我在set -x之后按下选项卡按钮时,它首先被卡住了。 I mean,我是说,

$ set -x
$ ls a<tab>
# got stuck like 2~3 second
output of `set -x`

Here's my pc information.这是我的电脑信息。

$ uname -a
Linux seongwoo 5.4.0-72-generic #80~18.04.1-Ubuntu SMP Mon Apr 12 23:26:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Although I'm using oh-my-zsh, it has same trouble when I exec /bin/bash .虽然我使用的是 oh-my-zsh,但当我exec /bin/bash时它也有同样的问题。

ran in a similar problem.遇到了类似的问题。 Either bash TAB-completion and ls command where very slow. bash TAB 完成和 ls 命令都非常慢。 After considering multiple solutions that seemed difficult to apply, I found this solution:在考虑了多个似乎难以应用的解决方案后,我找到了这个解决方案:

sudo updatedb

This solution is published on the blog https://blog.jaimyn.dev/possible-fix-really-slow-tab-auto-completion-ubuntu-bash/该解决方案发布在博客https://blog.jaimyn.dev/possible-fix-really-slow-tab-auto-completion-ubuntu-bash/

It seems to update the auto completion database.它似乎更新了自动完成数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM