1

Using Cygwin on Windows, I seem to be having an issue where using ls -l hangs for an abnormal amount of time, whereas using ls without the list argument, returns in almost no time at all.

[664] / *> which ls
/usr/bin/ls

[665] ~ *> time ls 1> /dev/null

real    0m0.065s
user    0m0.000s
sys     0m0.031s

[666] ~ *> time ls -l 1> /dev/null

real    0m10.836s
user    0m0.015s
sys     0m0.077s

What might be the cause / fix for this? How can I investigate (why) this is taking so much time? This only seems to happen in my %HOME% directory, all other locations seem to be instant.

Matt Clark
  • 27,671
  • 19
  • 68
  • 123
  • I'd be looking to see if there's anything different about that directory, mount/junction points and such, or strange files. By the way, `-l` is "long" format, not "list". – paxdiablo Sep 10 '19 at 23:34
  • Check which processes are working on your %HOME% and may cause disk contention, to see how visit: https://stackoverflow.com/questions/15708/how-can-i-determine-whether-a-specific-file-is-open-in-windows#188337 – AAber Sep 11 '19 at 09:32
  • Is your cygwin home directory on a network drive? Are you connected to a domain? You may need to set up a cygwin server to cache a large domain users list. – Doug Henderson Sep 12 '19 at 22:52
  • Yes domain, but my user director should be local? – Matt Clark Sep 12 '19 at 23:31

1 Answers1

1

-l causes ls to convert numbers into usernames, involving long lookup times in a big domain.

I highly recommend running cygserver. This has a number of benefits over and above the speed increase.

I once posted an answer to a related question on Stack Overflow, but it was migrated to SuperUser. So, rather unhelpfully, my suggestion is to go and look at my answer there.

double-beep
  • 5,031
  • 17
  • 33
  • 41
bobbogo
  • 14,989
  • 3
  • 48
  • 57