At one of our servers, by mistake I ran into shell/ssh the code:
`yes`; do ls; done;
And now I want to conenct back to it but it's still hung. What can I do?
If your system is not responding at all, I don't think you can do anything except hardware reset/reboot.
In a multi-core architecture, only one CPU core should be busy 100% usage. Other cores should be available. So, you should be able to connect to your server using another shell.
Well, if you still have a shell opened or you can open a new shell, you can kill the process by looking for it with ps aux and grepping for the name of the shell script. As MadHatter suggested you should use
If you can't connect to it through SSH, you will have to go there to get physical access I'm afraid (or something like remote hands) and see if it's salvageable or not. If not you will have to pull the plug.
Maybe if it starts using enough memory or resources, OOM killer will come buy and kill it, but there might be other stuff breaking then.