Re: Problem with ls on home directory



On Sat, 29 Apr 2006 11:14:18 -0400, Geico Caveman staggered into the
Black Sun and said:
I am facing strange problems with running ls on my home directory. I
issue ls, it sits and waits around for 2-5 minutes before it responds.

How many files/dirs are in your ~? ls has to sort all the filenames
according to locale and then combine them so they display efficiently in
a multicolumn format. ls is often aliased to "ls --color=tty" , so the
filenames may have to be colorized as well. All this takes a fair
amount of time if you have 10,000 or more files in your ~. In that
case, "ls -1" or redirecting ls's output to a file will be much faster
than normal ls.

The same happens when I try to do any file operations with other
applications (like attaching something to my email). [It's] almost as
if it is timing out for something. This does not happen anywhere else
down the directory tree.

If an app needs to display things in a GUI file selector, it has to do
much the same things as ls does. Which version of which distro are you
running? Which filesystem are you using for /home ? (ReiserFS is more
efficient than ext3 for directories with large numbers of files in
them.)

To find out what was going wrong, I issued strace ls, which ran
immediately.

Disk cache, or you actually typed "strace ls > strace.log 2>&1", not
just "strace ls". Doing the latter is usually not useful as there's too
much info in strace logs to fit well on an xterm. (straceing "Hello,
World" produces 17 lines; real programs tend to produce *at least* 10
times that!)

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / "He is a rhythmic movement of the
-----------------------------/ penguins, is Tux." --MegaHAL
.