Thursday, March 31, 2011

SSH, entered command but it didn't execute, can't type anything

I used the command tar -x file.tar.gz and, for one reason or anything it failed. Then I get stuck being able to type anything in, but not being able to run any more commands. Pressing enter just gives me a new line. I don't know how to break out of it either (escape etc doesn't work). The only way I can get back working is to close putty and reconnect.

Is there a way to get it back to normal so I can keep going because it's irritating closing it all the time.

From stackoverflow
  • Try hitting CTRL+C :) This will cancel/kill/stop the running command!

    But the best way to untar is to use -v to verbose the output :

    tar -zxvf yourfile.tar.gz
    

    With that, you'll perhaps see that your file just take more time than you thought unarchiving ;)

    damnitshot : Ooo thankyou very much :D
  • If you want to quit it, press CTRL+c. If you want to keep it but being able to write more commands while it's working, press CTRL+z and bg. Then it will work in the background.

  • Ctrl-C can be used to send a break to the executable that's hanging, but it's up to the application to handle it. Ctrl-Z will break you out of the running executable, but you'll need to then manually kill the process.

    What you're doing wrong is you're not gunzipping the archive.

    Try this

    tar -zxf file.tar.gz

  • Your command failed because it is trying to read stdin. This is because you never told it the name of the tar file with an "f" option.

  • A good Idea would be to use GNU screen. That way, when a command hangs, you can open another screen and take a look at the system (e.g. top to see if tar is still working) or you could kill the process by pressing (strg+a) + k to hard-kill the running process within the screen-session. Screen also has the nice feature that your processes keep running even though your SSH-connection died. It's a lifesaver!

  • Your tar invocation is waiting for input on the command line as the others pointed out. You may also use Ctrl-D to indicate EOF to the tar process.

0 comments:

Post a Comment