Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Case:

  • A Windows share mounted using samba over a flaky VPN connection (sometimes very slow, sometimes it drops)
  • When doing tab-completion on filenames, my bash shell can freeze up if the VPN is slow or dropped when I am attempting the tab completion.

Example:

$ cp myfile.zip /mnt/winbox-c/Progr<tab> key pressed here

Is there a key I can press to get bash out of its hung state when this happens?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Try CTRL+C

This works for me in tcsh and I believe it should work in bash as well.

share|improve this answer
    
Can it be that simple? I must have tried this myself, but perhaps not... I'll give it a try the next time the VPN is acting up and add a comment with the results. –  codeape May 13 '10 at 8:46
    
Of course, it works. Cannot believe I did not try something simple as that... Thanks! –  codeape May 13 '10 at 8:54
    
my pleasure :-) –  Nathan Fellman May 13 '10 at 20:08

Ctrl + C helps only if network is slow or not reachable.

But sometimes the problem is if it freezes for longer than you expect or never comes back, even after Ctrl + C or Ctrl + Z or any combination, where you end up just closing the terminal.

Then please check your PATH variable, if it is not set for any path mounted on network, you are not able to reach up.

That was at-least my problem.

share|improve this answer

In bash, I also found that CTRL+\ (control + backslash which I think sends SIGQUIT) also works, but leaves the cursor where it is instead of canceling the command completely.

I was looking for this answer myself because bash's ssh tab completion hangs for 5 to 10 seconds if it cannot lookup the remote hosts IP address. This happens on my home network where I don't have a local DNS. Setting correct IP addresses in /etc/hosts speeds it up.

share|improve this answer
1  
That works far better than Ctrl-C! –  idbrii Apr 30 '11 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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