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.

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:

The output of which looks similar to:

pinging this site just five times before stopping.
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:

stopping a terminal command with ctrl + c
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.

Pause And Unpause Your Terminal

Today, we’re going to learn how to pause and unpause your terminal. This will be one of the easiest articles I’ve ever written. It may also be one of the shortest! So, to learn how to pause and unpause your terminal, read on!

In fact, this information is so brief, I’m not quite sure how to turn it into a ‘full-fledged’ article. There’s really not all that much to it, but it’s information that should probably be on the site somewhere, and that somewhere might as well be here.

For many of us, we’ve learned that pressing CTRL + S will save whatever it is we’re working on. Well, that’s not the behavior you’ll see in the terminal – and from my testing, this appears pretty universal.

If you press CTRL + S  while in the terminal, which a new person may do by accident, it pauses the screen – making the screen appear as though it is locked. This can be confusing, especially to a new Linux user that’s not accustomed to using the terminal.

There’s no obvious way to unlock the screen. There’s no tooltip or anything like that involved, so a new person may just end up closing their terminal and opening a new one. You don’t have to close the terminal and start a new one.

Well, you can press CTRL + Q and that will unlock the screen. That’s really all there is to it – but there’s a caveat.

Pause And Unpause Your Terminal – CAVEAT:

Anything typed on the screen, any inputs entered in that terminal, will appear (and function) when you unpause the screen. This could be risky if someone has had access to the computer while you were away. Pausing the terminal in no way should be considered a security measure.

For example, press CTRL + S in an open terminal. Then type the following:

Next, press the ENTER button.

Finally, press CTRL + Q.

When you press that key combination, you’ll see that the ‘uptime’ command is going to be, and will be, executed. So, this isn’t even anything remotely secure. It’s useful for pausing when there’s a lot of information being fed to the terminal, and that’s about it. 

As far as I can tell, it’s more likely to be used by accident, tripping up new Linux users who may have hit the keys by accident or hit them thinking they’re saving something. 

Closure:

Well, that’s about as long as I can make this article without padding it for Google’s sake. It really doesn’t need to be longer than this to show you how to pause and unpause your terminal. It’s really just a simple matter to unpause the terminal without needing to open a new instance.

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.

Limit The Download Speed For ‘wget’

In today’s article, we’re going to learn how to limit the download speed for ‘wget’. It will be a short article because I’m watching a race and didn’t bother writing an article ahead of time. It’ll also be suitable for someone new to ‘wget’. So, to learn how to limit the download speed for ‘wget’, read on!

We’ve had a number of ‘wget’ articles in the past. There’s quite a bit to it. If you don’t know, you use ‘wget’ in the terminal, as a way to transfer files across a network. The ‘wget’ command is often used to download files from the internet. If you’re unfamiliar with the ‘wget’ command, it defines itself as:

Wget – The non-interactive network downloader.

There are a number of existing ‘wget’ articles if you want to gain some familiarity with the command. Here’s some:

Rename A File Downloaded With ‘wget’
How To: Hide The Output From wget
Make wget Use IPv4 or IPv6
How To: Make ‘wget’ Ignore Certificate Errors

Plus, there are numerous articles that used wget to download files.

So, when you’ve taken a look at those articles and feel you have a solid grasp of what ‘wget’ is used for, you might as well take a look at the man page to get a better idea of the possibilities:

With that information properly learned or refreshed, let’s just skip right ahead to the main article…

Limit The Download Speed For ‘wget’:

It’s a bit different lately, as I’ve been using a different ISP. In the past, if I was downloading anything the whole network would bog down. I’d use things like ‘wondershaper‘ to get around that. Else, if I was using ‘wget’ to download a large file, I’d limit the download speed.

This isn’t much of an issue with my current connection, so I don’t worry about it. Still, you might have all sorts of reasons to limit the download speed for ‘wget’. We can do that! You will need an open terminal, however. 

So, open up your default terminal emulator. 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.

If you don’t know what we’re looking for, we’re looking for the --limit-rate flag. It’s not all that complicated and looks like this:

For example:

Where you see 50k, you can change it to 100k, 500k, or whatever. The k obviously stands for kilobytes. You can also use m, as in --limit-rate=50m and that’s obviously megabytes. If you’ve got enough bandwidth for it to matter, you can even use a g in that space, and it’s obviously for gigabytes.

See? That’s actually all there is to it. I told you it was simple and quick! Tada! It was!

Closure:

And there’s another article. This one was hurried but hopefully is worth reading and sharing with your online friends. You’ll have learned that you can limit the download speed for ‘wget’, a potentially handy way to use the tool. You can combine it with the various other flags, so be sure to read the man page!

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.

Bring Your Network Up Or Down (In The Terminal)

In today’s article, we’re going to learn how to bring your network up or down – in the terminal, of course. This will be an article that’s easy enough for a beginner to understand. It’s not very complicated, so it should also be fairly short. If you’re interested in bringing your network up or down in the terminal, read on!

There are times when you may want to bring your network down and then bring it back up. Odds are that you can do this with a GUI, often with a network manager right there in your system tray.

You can also do this in the terminal. This is especially handy if we’re unable to reach a graphical state and need a network connection for things like updating and troubleshooting. We will use the ‘ip’ command for this, which is a pretty robust command. The ‘ip’ command describes itself as:

ip – show / manipulate routing, network devices, interfaces and tunnels

That’s an accurate description and we will indeed be manipulating network interfaces in this article. We will also be showing network interfaces in this article.

If you’d like to get a head start, you can read the man page:

That command will show you all the available options for the ‘ip’ command. We’ll just be using a couple of the commands, so it won’t be all that complicated or stressful.

Bring Your Network Up Or Down:

As the title suggests, we’ll be managing our network interfaces from the terminal. This means you’ll need to open your favorite terminal emulator at this point. 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.

With your terminal now open, you should identify your network interfaces. We can do this with the ‘ip’ command, like so:

Or just:

Hint: The connected device(s) will be those with the most information output. Like the wireless network interface in the following image:

output of the 'ip addr' command
As you can guess, that rectangle is a good indicator that it’s the ‘up’ network interface.

Now, if the network interface is down and you want to bring it up. The command is quite simple, it’s just:

So, in my case, the command would look like this:

If you wanted to bring it down, and mine is already up, the command would look like this:

With that, you can bring your network up or down as desired, and from the terminal. It’s not very difficult at all.

If you’re using an older distro, you might still be using ‘ifconfig’. If you are, the commands are a little different, and I include these only for completeness’ sake and would look like this:

And, of course, to bring the network interface down:

So, that’s not too dissimilar to the more modern ‘ip’ command and is still worth mentioning. For a while, as ‘ifconfig’ was sunsetted, you could use both commands with the Ubuntu flavors. In current versions of Ubuntu, you only have the ‘ip’ command available unless you install ‘net-tools’ for some reason.

Closure:

And there you have it! You can now bring your network up or down in the terminal, and it’s not even all that difficult. It’s yet another article and yet another skill you can add to your growing toolbox of commands. It’s just a subset of the things you can do with the ‘ip’ command, but it’s one of the more useful things you can do with it. So, there’s that…

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.

Another Way To Find The Binary For A Specific Command

In today’s article, we’re going to learn another way to find the binary for a specific command. This won’t be a very difficult article. It’s an article that will be easy enough for even new Linux users to follow. So, if you want to find the binary for a specific command, read on!

You’ll find some similarities between today’s command and the ‘which’ command, which we used in this article:

Find A Command’s Binary

Well, we’ll use the ‘whereis’ command in this article. The man pages for the ‘whereis’ command describe it ‘whereis’ thusly:

whereis – locate the binary, source, and manual page files for a command

You may recognize the command, as we’ve used it to find the man pages for a specific command. In that article, we discussed the possibility of using the ‘whereis’ command to do just this, but I feel it deserves its own article. The first article merely mentions the possibility, so an article specifically discussing this command’s use like this makes perfectly good sense to me.

So, let’s learn another way to…

find the binary For A Specific Command:

As you might have guessed, the ‘whereis’ command is a command used in the terminal. As such, you’ll need an open terminal. Just press CTRL + ALT + T and your default terminal should open.

Now, with your terminal now open, you can try to find the binary for a specific command. Let’s say you want to find the binary for ‘grep’. Then the command would look like this:

The output of which would look a whole lot like this:

whereis command finding the binary for grep
Where is grep? There it is! This will probably not work for Waldo. Or Carmen Sandiego. 

The extra fields are where the man page and info pages are located, and the first field is the path to the binary in question. So, if you want to find the binary file for Firefox, the pattern is:

So, for Firefox specifically, you’d run:

However, if you just want to find the binary for the specific command, you’d use the -b flag. That’s all you need to do in this case. It looks like this:

And that will output just the binary file’s location without the additional fields of man pages and info pages. See? It’s pretty easy after all.

Closure:

Well, there’s another article. This time around, we’ve learned another way to find the binary for a specific command. It’s another article in a long list of articles, indeed a growing list of articles. So, well, there’s that… Which is nice…

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.