I am using zsh with a bunch of plugins (Python venv, git status, etc).

Occasionally, when I cd to a directory, it waits for a couple of seconds before letting me type in commands. When I cd to the directory again, it's much faster. So I'm guessing there might be some kind of caching happening (perhaps one of the plugins is doing a network call?).

Since it's hard to reproduce, how can I diagnose what's causing the slowness?

  • if you enable execution tracing with set -x (disable with set +x), does it show the commands it runs when you change directories? If it does, you might see the lagging command there
    – ilkkachu
    Jun 14, 2022 at 20:49
  • It would also be helpful if we knew if the directories were on a network mount or purely local.
    – Bib
    Jun 14, 2022 at 20:57
  • @ilkkachu It does show the commands - I'll try to watch the output for a few days and see if I can catch the issue in action.
    – Jessica
    Jun 14, 2022 at 20:59
  • @Bib The directories are on an older hard drive mount (which is generally reasonably fast) but not on a network mount.
    – Jessica
    Jun 14, 2022 at 20:59
  • @Jessica, if the delays come after you haven't accessed that drive for a while, it might be that it's set to spin down if inactive. The next access would have to wait for the spin-up.
    – ilkkachu
    Jun 14, 2022 at 21:05


You must log in to answer this question.

Browse other questions tagged .