Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In unix-like system terminal, I sometimes used some commands incorrectly and make bash don't know what to do, but just pending on a newline. e.g.

grep 'word' -R

Then how can I make up to the mistake, or get rid of it to retry?

Looks like CTRL+C can help me return free, but not sure if this is a good practice?

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

if control+c is not working you can press ctrl+z which will send the process background. Once the process is in background you can kill it by using kill %1

share|improve this answer
add comment

Yes, pressing CtrlC repeatedly is the "usual" way to get out of commands waiting for additional input, or canceling running foregroud processes. You will end up with the normal shell prompt.

CtrlL clears the screen, which might also come in handy.

share|improve this answer
add comment

For applications taking input, CtrlD will end the input. For example, tail without any parameters will tail standard input, so you can start typing on the screen. And when you finish (and you want it to actually tail), you press CTRL+D.

share|improve this answer
add comment

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.