You are not logged in.

#1 2019-04-05 08:17:54

IndianSpongebob
Member
Registered: 2016-07-13
Posts: 13

ls taking too much time

Recently, I've came across a weird problem. I've found out that executing ls from my terminal (tried with zsh, and bash) is too much time. Here's the output of `time ls`:

...
...
ls --color=tty  0.00s user 0.00s system 0% cpu 1:30.03 total

Now, this problem is particular to only my home directory. No other directories I've tried so far seem to have this problem. What I've found out to be more strange is that if I try redirecting the output of `ls` to a file with `ls > my_files` and then `cat my_files`, it takes the usual amount of time. Could it be that there's some file with some special character sequence that's causing the terminal to freeze up? If so, how should I go about finding the culprit?

Thanks.

Offline

#2 2019-04-05 19:02:30

natervance
Member
Registered: 2017-04-20
Posts: 53

Re: ls taking too much time

Given the timing breakdown it appears to be blocking an unreasonably long time on IO. Do repeated back-to-back executions reduce the time delay (listing gets cached in RAM)? And is your home directory on a separate disk/partition from the rest of your system? If so, then you should investigate the integrity of the disk using a tool like SMART, or running a file system check.

Also, does the problem persist when using `ls --color=none`? What if you list your home directory as the root user (who is presumably using a simpler profile)? Finally, if you are using a fancy terminal, do you observe the same behavior in xterm or the framebuffer?

Offline

#3 2019-04-05 19:25:20

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: ls taking too much time

Defragment the filesystem, perhaps?

e4defrag ~/

Jin, Jîyan, Azadî

Offline

#4 2019-04-05 21:52:46

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,520

Re: ls taking too much time

The filesystem theory collides with the suggestion that subsequent calls are affected, but redirected ones are not.

My money would be on the terminal indicator, the mount of files, coloring and layout (also try "ls -f1")

Online

#5 2019-04-06 03:54:21

IndianSpongebob
Member
Registered: 2016-07-13
Posts: 13

Re: ls taking too much time

natervance wrote:

Given the timing breakdown it appears to be blocking an unreasonably long time on IO. Do repeated back-to-back executions reduce the time delay (listing gets cached in RAM)? And is your home directory on a separate disk/partition from the rest of your system? If so, then you should investigate the integrity of the disk using a tool like SMART, or running a file system check.

Also, does the problem persist when using `ls --color=none`? What if you list your home directory as the root user (who is presumably using a simpler profile)? Finally, if you are using a fancy terminal, do you observe the same behavior in xterm or the framebuffer?

I don't think the issue is filesystem related as `ls --color=none` is taking the usual amount of time to complete. And by the way, I'm using xterm. Maybe it's something to do with the color profile? I'll try changing it out. Thanks for your reaply.

Offline

#6 2019-04-06 03:56:05

IndianSpongebob
Member
Registered: 2016-07-13
Posts: 13

Re: ls taking too much time

Head_on_a_Stick wrote:

Defragment the filesystem, perhaps?

e4defrag ~/

Thanks Head_on_a_Stick, but it does not seem to be a fragmentation related issue as trying ls explicitly without colors and formatting seems to resolve the issue.

Offline

#7 2019-04-06 05:58:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,520

Re: ls taking too much time

Briefly ensure that it's not  the TE (try eg. urxvt) and then strace the call to see whether it stalls for a specific file.

Online

Board footer

Powered by FluxBB