Ping With IPv4 Or IPv6

Today we’re going to have a fun article, one easy enough for everyone, where we talk about how to ping with IPv4 or IPv6. You have an option and you get to decide if you want to use IPv4 or IPv6. It’s just a matter of a couple of different flags, so a new user can manage this one.

An IP address is a numerical address assigned to computers, it’s a way to address those computers – meaning to send and receive data. While you normally don’t do much with individual IP addresses, they’re what runs in the background and make this whole networking thing happen.

We had IPv4 and we’re slowly moving to IPv6. We’ve long since run out of IPv4 addresses (though they’re still widely used, often for legacy reasons), but they’re 32-bit addresses while IPv6 is a 128-bit address.

If you’re not good at math:

IPv4 supports 4,294,967,296 addresses.
IPv6 supports 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses.

See the difference?

There was an IPv5 but IPv6 was created before IPv5 was made a standard and so there’s no IPv5 standard. The reasons for this are fairly obvious. After all, IPv6 supports a metric buttload of devices. That’s a seriously big number that we write as 128-bit (2128).

Every human on the planet can have all the addresses they could use, which is important when you consider stuff like IoT (internet of Things) where your home may contain many connected devices in the ‘smart home’ sense of things. We decidedly do not have enough IPv4 addresses for that.

Well, the truth is that we kind of suck at migrating to IPv6. Wh you ping localhost, you’re probably going to see 127.0.0.1. If you’re using IPv6 then you’d see ::1. If there’s any place where we might want to use IPv6, it’s in the home – with all these connected devices.

Even if you don’t have a smart home, smart cameras, a doorbell camera, various routers, a connected refrigerator, or the like, odds are that you’ve got more than one connected device. Fortunately, you still have IPv4 going on and they have some reserved IP addresses to work with. So, you’re good with that – as a general rule.

So, we still use IPv4. Should we? Probably not. But, there are legacy reasons for IPv4 to exist. That shouldn’t include the public web (I don’t believe) but it does. The adoption rate for IPv6 is really slow. After all, IPv6 launched on June 6, 2012. We’ve had more than a decade to move to IPv6!

I am no help… I am just as guilty as anyone else. When I order a VPS, I ensure that I have a dedicated IPv4 IP address. Why? Legacy reasons! Well, more out of habit. I’m quite sure I could migrate to IPv6 by just changing a few things in my process.

Anyhow… This is a long intro!

What is this ‘ping’ thing? Well, ping is you sending a packet to an address and then waiting for the response. You ping a server and the server effectively sends a pong back! It’s ping pong! Ha! I crack me up. 

You send a ping and wait for an acknowledgment from the server when it sends a packet back to your computer. Ping doesn’t always work because you can decide to ignore them (perhaps a future article) and not send a response. Fortunately, the easy-to-remember domain names (remember, they respond on an IP address, they are resolved to an IP address) respond to pings. I use ‘google.com’ as a general rule.

If you check the man page, ping describes itself like this:

ping – send ICMP ECHO_REQUEST to network hosts

We’ll be using ‘localhost’ (your computer) for this article, for the record. I think that’s a better choice than having a bunch of my readers ping any specific website. It should be effective on every modern computer with a modern operating system.

Man, this is a long intro. I’m sure I’ve forgotten something…

Ping With IPv4 or IPv6:

By now you know the routine. You’ll be using a terminal for this exercise. If you don’t know how to open your terminal, try pressing CTRL + ALT + T and (in most cases) and your terminal should pop right up! It’s magic!

Believe it or not, this may also work for other operating systems. I have it on good authority that this works with Windows, where they’ll be using ‘cmd.exe’ as memory serves. From what I can tell, this is also true for MacOS users. It’s a fair assumption to say this also works with the operating systems in the BSD family. Huh… Imagine that?!?

Anyhow, you can try the following command:

That will resolve to an IP address, be it IPv4 or IPv6. You can ping a specific IP address easily enough. To ping an IP address, the syntax is:

The results of those commands will be either an IPv4 or IPv6 address. If you’re new and don’t know the difference, an IPv4 address uses periods. It’d look like 127.0.0.1. An IPv6 address uses colons. It’d look like 2607:f8b0:4006:817::200e. It’s easy to tell the difference.

Now, if you want to use IPv4, the command would be like this:

If you want to use IPv6, the command would be like this:

NOTE: This is likely to work in many instances but, due to the lack of participation, you might find that some sites don’t support IPv6. On the other hand, you might find some sites don’t support IPv4. If one doesn’t work, then you have the other as an option.

Closure:

Well, if you ever wanted to know how to ping with IPv4 or IPv6, you now know. Are there good reasons? Well, there’s still some legacy stuff out there and we’ve poorly adopted IPv6. For all intents and purposes (intensive porpoises) we have limitless IP addresses available with IPv6.

We will move in that direction, just like we’ve currently moved in that direction. Adoption will continue and adoption rates may speed up. After all, we’ve had more than a decade to adopt. The specification is well-supported and it’s almost certainly the future of networking. Or so I’d like to believe…

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Add A New Line With CURL

Today’s article isn’t going to be all that long and it’s definitely not going to be complicated, as we just discuss how to add a new line with curl. It’s just an annoyance factor and something I was reminded of today. Lacking a better idea, I decided I’d use this annoyance and recollection as a reason to write an article about how to add a new line with curl.

First, this obviously requires a terminal.

Second, this obviously requires curl. You almost certainly have curl installed, so you won’t have to install anything. 

If you’re curious, you’ll find that the curl man page defines the application as:

curl – transfer a URL

You’ll understand why I’d use that in a second, but you can imagine that it’s a pretty handy tool to have in your Linux toolbox. We’ve previously used curl in many articles. Here’s a sampling of those articles:

Let’s Have a Limited Look at Linux’s cURL Application
Weather In The Terminal? We can do that!
How To: Find Your IP Address Through Your Terminal

… and more!

So, in this case, I show ads on the site. To do this, Google relies on a file known as ‘ads.txt’ being in your web’s root folder (often called ‘public_html’). If the file is not there, there’s an ad inventory issue and Google won’t show ads.

Well, if you read the previous article you’d know that there was an outage. During this outage, it appeared that the site was still reachable – except it wasn’t. It was during this time that AdSense decided to check and see if the ‘ads.txt’ file is there. (This is nothing private. Everyone using AdSense has an ads.txt file.)

Because of this, I decided to verify that the ads.txt file existed and contained the appropriate information. To do this, I simply used the following command:

It gave me the answer I wanted, but I disliked the formatting of the output. But, it was enough for me to determine that the file existed and that I just had to wait for Google to confirm this.

The formatting was horrible. I’ll show you an image in the next section and you’ll see…

Add A New Line With curl:

So, when I saw the output from the above command (feel free to run it on your computer), it just ran the line into the next prompt. I had to dig through my ~/bash_history file because I couldn’t remember how to fix the formatting.

A picture is probably going to describe this best. In the picture, you’ll see the ugly formatting and you’ll see the solution.

adding a new line to the curl output
As you can see, the second command has a much nicer output.

So, to make sure you have a new line, you use the -w (write-out) flag and add the character for a new line in quotes – which is "\n". It’d look like this:

As you can see (and I hit the enter button between commands to start on a fresh new line) the output is much nicer. So, instead of curl starting a new line, a command entry line as it were, you’re starting with a nice fresh new line.

I messed with this way too long before I started digging into my bash history to find other curl commands used over time. Eventually, I found it, but I’d already verified that the file existed and that Google would notice the next time they checked.

Closure:

Well, it’s not the greatest of articles – but it’s useful if you want to know how to add a new line with curl. It’s a much tidier output this way. I just need to remember to do it without having to dig through my bash history each time I want to have a clear curl output.

Meh… I’m sure it’ll eventually be handy for someone…

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Boot To Text Mode In Linux

Today’s article will be a quick and easy article, so easy that a newbie can follow it, and will cover how to boot to text mode in Linux. Booting to text mode is something you might want to do for troubleshooting or repair. It might look hard, and require some good timing, but it’s not all that challenging.

What do I mean?

Well, when you boot your personal computer with Linux on it the system boots into a graphical environment, a GUI. If you boot to text mode, there’s no GUI being loaded. It’s just like you were working in the terminal, but there was no GUI to fall back on. 

For most people using Linux on the desktop, this isn’t something done all that often. It’s mostly useful for things like the above-mentioned troubleshooting and repair. When there’s a problem that’s exacerbated by the GUI, booting to text mode is a good idea and a great feature.

This is only for systemd users and is sometimes called ‘console mode’. This article also assumes that you’re using GRUB as your bootloader. If either of those is not true, you can safely ignore this article.

If you’re asked at a forum to repair your system by booting into text mode, this is the article for you. It’s not something you’ll need often, but it’s something worth knowing, or at least knowing that it can be done. It’s not even all that complicated.

Also, if you noticed an outage yesterday, there was a giant dumpster fire that needed to be put out. It wasn’t a literal dumpster fire, just a bunch of crap that all managed to land at the same time.

The symptoms made me think the site was hacked, but that’s not what happened. There were some changes made at the server level and things did not trickle down. The server migration went well for many people, but I have a complicated setup. I also use a CDN, which further compounded the issues.

Things were fixed upstream. There was no hack, but there were some traffic spikes recently. Nobody’s personal information was leaked. No software was compromised. It was just a ****storm that required more effort than expected.

The server is still being worked on as I write this article. Data was seemingly corrupted in multiple tables, which shows the value of backups. Nothing of any value has been lost in the process – except some traffic. I hope that those people were able to find the information they were looking for, and I formally apologize for the downtime.

Boot To Text Mode:

You need some pretty good timing for this and it may take some people a few tries to get it right. I’ve done this many times and I still don’t always get it right on the first try.

When you boot your computer, it performs the “POST” (which is the Power On Self Test). It goes by quickly these days. In many cases, it doesn’t even tell you that it’s performing the POST. In those cases, it may show you a logo for the computer. It happens on your computer, even if you don’t see it.

Now, between the end of the POST and before Linux starts loading, you need to press a key to stop Linux from loading. You want to access GRUB.

The key you press is going to vary, but it’s just one of two keys.

If you’re using legacy (BIOS) then you need the SHIFT key.

If you’re using UEFI, then you need the ESC key.

After POST ends and before GRUB loads Linux, you need to press the appropriate key. You need to know which you’re using, BIOS or UEFI. You could just keep trying until you find out which one works for you. With the reduced friction between Linux and UEFI, you might not know which system you’re using. I suppose that’s a good thing.

Anyhow, you should end up with a screen that looks like this:

the grub menu
The helpful arrow is your next step in this process of booting to text mode.

As you can see, you next want to press the E on your keyboard.

You’ll next see a screen that looks like this:

this is the boot parameters in use
These are the boot parameters in use by GRUB. We’ll edit this.

Use your arrow keys to navigate to the line that begins with linux.

Make sure the line also includes vmlinuz.

The line you want to edit will start with the first word and contain the second word, but it will exist.

You want to go to the end of that line. Depending on your GRUB resolution, the line may span multiple lines. In other words, you’ll be editing where there’s a hard new line and not paying attention to the actual formatting.

That may look something like this:

this is the file you want to edit.
That’s the line you want to edit. Note that it spans two lines.

At the very end of that line, you simply need to hit the space bar and add the number three. Like, literally, you’re just adding:

In the example image above, that 3 would be added just after the word ‘handoff’. The 3 is telling the system to boot to the multi-user.target and doesn’t load a graphical environment.

There are directions at the bottom, but just press F10 to continue booting to text mode. The next screen you see should look a whole lot like this one:

This is the result if you decide you want to boot to text mode in Linux.
Tada! That’d be a success. If you see that, you’ve booted into text mode! Congratulations!

This isn’t a permanent change. When you use this method to boot to text mode, you’re only going to boot into text mode that one time. There are ways to set the computer to always boot to text mode, but that’s not within the scope of this article. 

You may have to try this a few times. The process is simple after you get to the GRUB menu, but accessing that GRUB menu may be problematic. You may need good timing (unless you’re set to display this screen on every boot) to access the menu in the first place.

Again, you’ll need to know if you’re using BIOS or UEFI. That’ll help you avoid frustration. I linked to it above, but it wasn’t all that well highlighted. I’ve written an article that teaches you how to tell if you’re using BIOS or UEFI.

Knowing which key will bring up the GRUB menu might just save you a bunch of frustration, as I know this has frustrated people in the past. This bugged one user enough for them to insist their OS didn’t have the option, that it was impossible to do. (They were using one of the official Ubuntu flavors, with a default install. So, they were just upset that they couldn’t get it working.)

Closure:

If you remember the intro well, you’ll know that this article has some drama behind it. You’ll know that the site was down yesterday and that there were continued issues today. I was awake at 04:30 to see if the site was up and running. Things looked pretty good.

I then wrote one article and the system went crazy, crashing when I tried to schedule it for publication. The upstream hosting company then tried some more magic potions and they wanted me to try again.

Alas, that ate the article I wrote…

Fortunately, WordPress is awesome and they stored a cached copy in my browser’s cache. They found this and propagated almost all of the fields. This was great!

That was when I noticed that I’d already covered that subject in the past – twice in fact. In my defense, I write a lot of articles and this was a fine subject to write about. 

At this point, I just wrote another article. That’s this article, for those who weren’t keeping track. We’re still not 100% certain that all the bugs are ironed out, but we’ll see. I’ll schedule it for publication at the usual time and try to observe this as much as I can. This presumes that I’m able to save it and schedule it without any problems. We shall see… (The save draft button does appear to work.)

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Geolocate A Website

Today’s article probably will be more about amusement than it is about education, as we learn to geolocate a website. This will not have a lot of uses for many of you, and the uses I can think of are a bit contrived. So, stand back and watch as we do some science!

Wait, no… No, there will be no science.

What I should have done is write this article ahead of time. Instead, it’s the 4th of July, and will probably be just about the 5th of July before I finish this. Let’s just all agree that I’ve been celebrating.

Anyhow, have you ever wanted to know where a website is located? Have you ever wanted to know where an IP address is located? Well, that’s what geolocation does and let me tell you that it is not excellent. No, it is not.

First, the tool we’ll be using is only going to give you the country. It doesn’t narrow it down very far.

Second, in the world of CDNs (Content Delivery Networks), a server may appear closer to you (or in this case the geolocation server) than it is. 

Relying on this data for anything important is just plain silly. 

But, you could log in to a remote server by name, get the local IP address, and then check the IP address to see what country the server is in. Yeah, see? I told you that any usefulness would be contrived.

Anyhow, you can geolocate by domain name or by IP address. With any luck, you’ll be able to tell which country the server is in. The previously mentioned caveats should make sure you know to not use these results for anything useful. 

Geolocate A Website:

You could almost certainly find an online tool that would do a much better job. Installing software for this is not necessary, but that’s exactly what we’re going to do. So, press CTRL + ALT + T and let’s get this party started.

First, we need to install a piece of software called Geoip. It’s available for all the major distros and describes itself as:

geoiplookup – look up country using IP Address or hostname

To install the software, you’ll enter one of the following commands into your terminal of choice:

RHEL, CentOS, Fedora, etc:

Arch, EndeavourOS, Manjaro, etc:

Debian, Ubuntu, Mint, etc:

When you’re done with that, it’s pretty easy to use. If you want to geolocate a website, the format follows:

And, if you want to geolocate an IP address, the syntax is similar:

An example output follows:

Which, you know, isn’t all that helpful. You can check the man page, but that’s also not all that helpful. To do that, it’s just this command:

The data isn’t entirely useless, for example, you can try this command:

Which, as you can see, appears to accurately geolocate the domain name to Canada, which is where I’d expect the server to be.

Closure:

So, yeah… If you want to geolocate a website then you can more or less do so. You’ll not get a whole lot of useful information and there are better tools for this online, but it can be done. You can indeed geolocate a domain name or an IP address all from the comfort of your terminal.

Just, you know, don’t use this information for anything too important. I use MaxMind for this sort of stuff online. It’s useful for getting meaningful statistics regarding the site’s traffic and is much more accurate, but still not accurate enough to pinpoint a house or anything. It can usually narrow things down to the nearest city, which is more than enough for my needs.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Open ‘WebP’ Images In Linux Mint

Today’s article shouldn’t be all that complicated, as we’re just going to touch on how to open WebP images in Linux Mint. I am not sure how many people this will help, but it seems like a good idea for an article. It’s also something I’ve recently dealt with, so it’s fresh in my memory. So, if you want to open WebP images in Linux Mint, read on!

Why Linux Mint? Well, because I know it works in Linux Mint. I just happened to be using one of my Linux Mint systems when I encountered this problem. I’m positive this works in other distros, but I’ve only tested this with Linux Mint.

The Story:

I wrote an article about how to disable window grouping in Lubuntu. A lovely friend pinged me to a question on AskUbuntu that involved this subject, suggesting that I answer it. I decided to answer the question.

Being lazy, I wanted to answer the question using the same screenshot I’d used in the article. I did the rational thing and downloaded the file from the linked page. 

The image had a border around it and I wanted to remove that border. I went to open the file with the WebP extension in my image viewer only to learn that there was no native support. When I opened the file, it showed the image in a new browser tab.

I could open the file in XnView and be done with it, but that wasn’t good enough. I wanted to be able to open the file natively, in my default image viewer. Alas, time was of the essence and I put that task aside so that I could answer the question. Later, I’d return to the problem and find a solution.

For reference, this is what it looked like when I tried to open a WebP file with the default image viewer:

there's no webp support
As you can see, that’s hardly a productive image.

It would happily show the image in the browser I had open because the WebP format is meant for the internet. That’s hardly useful and opening a browser to view an image just seemed like a step too far.

If you don’t know what WebP files are, you see and deal with them constantly – even if you don’t know, you can read the Wikipedia article about WebP files. They’re image files that are optimized for web use.

I wanted to find a way to open WebP images natively in Linux, specifically Linux Mint. My quest sent me down several false trails and I eventually found a solution that worked. This article shares that with you…

Open WebP Images In Linux Mint:

That’s right, there is a solution. To do this, which is open WebP images, we will need to have an open terminal. It’s okay, you only need it for a few commands. So open your terminal emulator. In many cases, you can just press CTRL + ALT + T.

With the first command, we’re going to add a repository:

Follow the directions and add the repository. Then you need to update the list of available software, like so:

Finally, install the following software with this command:

You don’t need to do anything else. That’s it. That is all you need to do. When you next open a WebP image in Linux Mint, you should be able to do so just fine with your default image viewer.

It should look something like this:

when you've completed these steps, you should be able to view WebP images in your default image viewer
See that image? That right there smells like success! It’s a WebP image!

If you click on that image, you can see that it’s a WebP image by looking at the title bar. The application should look familiar. It should look exactly like the default image viewer included with Linux Mint.

And now you know…

Closure:

That’s all there is to it. Linux is great like that. Sure, it took a bit of digging but there was a solution to my problem. Once I knew the correct solution, it was easy to implement. If you want to open WebP images in Linux Mint, you can do exactly that – without all that much effort. If you dream and work hard enough, someone else will have already done all the work and you can just use their software to accomplish your goals!

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.