General

How To: Terminate A Terminal Command

Today’s article is going to be a very brief article, prompted by a question on one of the Linux support forums about how to terminate a terminal command. The poster got an answer, but it was the additional comments that made me realize how few people know how to properly terminate a terminal command – specifically new users.

So, if you want to learn how to terminate a terminal command, read on!

As I said, this isn’t going to be a very long article. I have actually covered this before in another article – but it kinda deserves its own page/article. It’s not a very long and detailed exercise, but it kind of got lost in the mix and I’m compelled to write this article.

I want to make sure that this information is easily found via search engines because the answers I saw to this question included things like ‘just wait’ or ‘start another terminal, just close that one’. None of those are the ‘right’ answer to the question. None of those are the proper way to terminate a terminal command. 

So, let’s see if I can turn this tiny command into a full article about…

How To Terminate A Terminal Command:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Let’s use the ‘ping’ command as our tool of choice for this exercise. If you type in the following, you’ll continue pinging my site until you tell it to stop.

ping linux-tips.us

Of course, you can limit the number of pings you send. That’s easy enough. If you wanted to ‘ping’ linux-tips.us five times, you’d run this command:

ping linux-tips.us -c 5

The output of which looks similar to:

That’s how you properly limit the number of pings to linux-tips.us. Pretty easy, right!?!

But, you can run the first ‘ping’ command and just tell it to stop running whenever you want. The command to do so is:

CTRL + C

The output of this would look similar to this:

This stopped the command after five runs – but I personally stopped it with the CTRL + C option.

So, if you want to stop a running terminal command, it’s pretty easy. You just need to press CTRL + C on your keyboard and the process will stop. You will have terminated a terminal command the right way.

Note: You don’t always want to terminate processes. Things like terminating a device that’s in the process of upgrading may lead to an unstable condition. Then, for example, terminating a write operation may result in a loss of data.

Processes like that normally shouldn’t be stopped. In those cases, it’s best to just let the computer finish what it is doing – unless, of course, you do need to stop them because you have reasons to do so (like you started writing to the wrong device).

Closure:

Huh… I managed to kinda turn it into a full article, so there’s that. It really is a simple concept and the shortcut to terminate a terminal process is easy enough to remember. In an ideal world, this article will rank well in the search engines and save new Linux users time and effort. I’m not sure if I should aim for ‘terminate’ or ‘stop’, but this needs to be common knowledge – or more widely known than it seems to be at the present.

Also, just because you closed the terminal where you started the process doesn’t mean the process itself has necessarily ended. So, there’s something else to keep in mind. A process can and will happily keep executing even though you’ve closed the terminal. Linux is like that!

I wasn’t really sure that I could fluff this up into a complete article, but it appears that I’ve kinda pretended to do just that! Well, you’ll have another article in just a couple of days. It’ll probably be more involved than this one! This one is all about that CTRL + C function.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Installing Flatpaks In Linux

Today we're going to have a pretty easy article where you'll learn about installing Flatpaks…

15 hours ago

A Quick Look At The Shutdown Command

This is going to be just a quick article about a command many of you…

3 days ago

Setting Up Coding Environments on Linux for Educational Use

With so many strong attributes, such as robustness and flexibility, Linux stands as a powerful…

5 days ago

View Detailed Hardware Information

There are many tools for showing your hardware information and today we'll get to view…

7 days ago

How To: Install Wine In Lubuntu

Today's article isn't going to be complicated or long as we are going to cover…

1 week ago

Update Python Packages (PIP)

We've had a run of Python packages recently and you can tell that I'm a…

2 weeks ago