1

Sometimes I'll accidentally/instinctively double tab in a directory I probably shouldn't have. In the current case, the reason I'm writing this, it is on an old, very full cifs drive.

Of course, this causes the controlling terminal to hang waiting for the directory listing, Ctrl+C does nothing since it's sending an interrupt to the wrong process (the listing was spawned in a sub-shell, I assume).

Is there any way to kill this listing? Is it something that's visible in a process list or do I just have to wait for the listing to come through (it doesn't seem like there's a timeout).

This is in Bash on Ubuntu 16.04.

Not a duplicate of "how to disable". I don't want to disable the feature, I want to know how to halt it when it's been run accidentally on a directory listing that will take a very long time.

2

Ctrl+C does nothing since it's sending an interrupt to the wrong process (the listing was spawned in a sub-shell, I assume).

It's sending an interrupt to the right process but the process is in uninterruptible sleep.

An uninterruptible sleep state is a sleep state that won't handle a signal right away. It will wake only as a result of a waited-upon resource becoming available or after a time-out occurs during that wait (if specified when put to sleep). It is mostly used by device drivers waiting for disk or network IO (input/output). When the process is sleeping uninterruptibly, signals accumulated during the sleep will be noticed when the process returns from the system call or trap.

In Unix-like systems the command ps -l uses code D for the uninterruptible sleep state of a process. Such processes cannot be killed even with SIGKILL and the only non-sophisticated way to get rid of them is to reboot the system.

So

Is there any way to kill this listing?

Reboot.

Is it something that's visible in a process list?

Yes. A process in D state.

do I just have to wait for the listing to come through?

Yes. Or reboot.

Related: What if kill -9 does not work?

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.