1

When I run commands and I want to exit, I just press Ctrl+C and it works. But there are some times when this does not work, and the only way of executing another command is closing the terminal and opening a new one. I would like to know how to force the exit. For instance, it happens when I run:

git log 

It starts reporting all the commits, and if I press ESC or END I can read the words END and ESC in the bottom, but nothing happens if I press them. So, what does it mean? What is the way of finishing any command?

2 Answers 2

2

In the git log example, just hit the q key. Q quits the current action. Q also works in the more command, and others.

1

It depends on if the process running respects the particular signal being given. So for example, on Linux systems the "ctrl + c" gives a SIGINT. You could also try a "ctrl + z" to see if it respects a SIGTSTP. That doesn't actually kill the process though, so afterward if you wanted to finish it off you'd have to find the job ID and kill it. A default kill command sends a SIGTERM and a kill -9 sends a SIGKILL. Of course, for the kill commands you'd need to open a new terminal and determine the process ID of what you want to kill. In the end, there's no "silver bullet". SIGKILL is often considered to be the "strongest" but it also is the harshest and is only recommended as a last resort since it doesn't allow the process to gracefully terminate. Here's a link to a more complete list of signals:

https://en.wikipedia.org/wiki/Unix_signal

A lot of projects will consider it to be a bug if they don't properly handle certain signals. So it's always an option to log a bug with the project that isn't acknwledging a "ctrl + c" and see if they'll fix it to handle SIGINT in an expected way.

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.