What is my Hostname in Linux?

For most of you, your hostname in Linux is going to be the same as your username. This article will help you figure out your hostname in Linux, and it should be a relatively short article. If this article looks familiar, it’s because it existed at the old site, but with far less information.

Let’s start at the beginning, by learning what a hostname is.

A hostname is generally meant to be a human-readable way to identify a computer. Yes, the computer is truly identified by the associated IP address, but the hostname resolves to that computer. It is meant to be easily remembered instead of having to remember a bunch of IP addresses. Without it, the web (and your own local networks) would be more difficult to navagate.

In many instances, it’s a FQDN (Fully Qualified Domain Name), such as a domain name like linux-tips.us. However, this site doesn’t have a dedicated IP address, so it’s known by a virtual hostname as a FQDN. If the site had been constructed differently, you’d be able to access it with the IP address. For example, https://172.217.10.14 will take you to Google (after some warnings).

So, your hostname in Linux isn’t always going to be the same as your username. For most of the readers here on L-T.us, it will be. You probably don’t really need to worry a whole lot about things like virtual hosts and stuff like that. But, even as a home user, you can make use of this information.

How is it useful? Well, if I want to SSH into my MSI laptop, I don’t have to use the IP address. Not only that, if the IP address changes then I don’t need to look it up. I just connect with something like:

You may notice that I added the .local. You too can just add .local with many distros, in others the default might be something like .localdomain – which you can keep as the default or change it easily enough.

So, let’s figure out how to find your hostname in Linux.

Find your hostname:

Let’s start by cracking open the terminal. You can use your keyboard to do this, just press CTRL + ALT + T and your default terminal should open up.

Now, we can try the following:

Or you can try:

Or you can also try:

As near as I can tell, one of those should work on all major distros. If it none of them work for you, please leave a comment letting me know what does work – helping those who come behind you.

Using Your hostname in Linux:

There are a number of ways that this information can be used. With many distros, as mentioned above, you can add .local to the hostname and just use that instead of IP addresses. Here’s a picture that shows a few examples:

using hostname in Linux
Instead of using the IP address, use the hostname. It’s a pretty handy feature.

There are, of course, other things you can do with this information. Those are just a few examples. The great thing about using a hostname in Linux is that you’ll not have to recall IP addresses. You’ll only need to recall a name – a name that you picked.

You can change your hostname, but that goes beyond the scope of this article. I’d expect to see an article about that in the future! In the meantime, if you can think of any ways that you’d use the hostname, please leave a comment.

Closure:

Thank you, my dear reader, for your viewership. Your comments and feedback keep me motivated and your feedback helps to improve this site. For those who have been keeping track, you can actually now click on large images to see the larger versions. This will only be for future articles, as I’m unlikely to go back through every previous article and change it. But, it was direct feedback that resulted in the change.

If you’d like to contribute, there are a number of ways. You can donate, write an article, unblock ads, buy hosting, and sign up for the newsletter. I promise, I’ll never share your email address with anyone and I won’t send you any spam. Until next time…

A Few Ways To Visualize Disk Usage In Linux

I woke up this morning, took care of things like showering and eating, and then meandered to my computer. Swishing the mouse back and forth brought the screen to life, where I was greeted by a message that my computer was out of space.

It turns out that a backup cron job seems to have gone haywire and I had nested backups on my internal disk drive that occupied a great deal of space. However, I had only a hunch and couldn’t see where the problem was.

The problem was, as it turned out, a folder in /home/kgiii – and it was helpfully named as a backup should – meaning the errant directory was /home/kgiii/kgiii.

Of course I’m not going to notice that! The directory name doesn’t look out of place! It looks like it belongs there, it looked perfectly normal, so it didn’t leap off the screen to tell me something was amiss.

Really, I’m definitely not going to notice it while catching up on everything I check daily and while still on my first cup of coffee! The directory was my username in a directory named my username. It might just as well have been microscopic.

Either way, I didn’t worry too much. I knew that I should have plenty of space and that I could probably figure it out pretty easily. After all, it’s easy to visualize disk usage in Linux. This article show you a few ways to visualize your disk space. It should also be a pretty short article.

Visualize Disk Usage:

#1 Baobab: 

Baobab is the first of the three, and the most unique of the three. It’s not that it’s particularly unique, it’s that the other two are really quite similar. It’s typically a part of the GNOME desktop, but can easily be installed most any system. If you’re using a distro with apt, it’s installed with:

You can open it up, drill down, and graphically see how your disk is being used. You can see which files and folders are taking up the most space. It looks like this:

baobab in action
My Documents directory is nice and empty. I should have taken screenshots sooner.

It’s really self-explanatory after you’ve installed and opened it. Baobab is named after the tree, and appropriately shows the drives and directories in tree format. Imagine that!

#2 K4DirStat

K4DirStat is typically used with KDE, but can be installed on most any desktop. It’s another handy GUI way to visualize disk usage. If you’re a recent Windows user, then it may remind you of WinDirStat as the two are visually similar. It’s easy enough to install. Again, if you use apt:

K4DirStat is pretty self-explanatory. Open it, select where you want to start investigating, and wait. Once open and/or you’ve drilled down, it looks like this:

KDirStat in action.
This one is pretty intuitive and fun to play with while viewing disk usage.

This one has been around for quite a while. You may already be familiar with it. These applications are all a little slow when opening, as they have a lot of data to load and calculate. So, you’ll need to be patient.

#3 QDirStat:

QDirStat is pretty much exactly the same thing as the above. It’s based on K4DirStat, but built with and for the Qt library. So, you’ll want to consider it as an option if you’re using something like Lubuntu which is now using LXQt. But, most modern Linux distros support Qt out of the box and you can install it with:

Visually, it looks much like K4DirStat. It’s a simple block view that shows you the file sizes in comparison with the files around it. It will also helpfully color-code files. It looks like this:

QDirStat in action.
As you can see, it looks a lot like the previous option. Not a whole lot going on there.

It’s pretty similar to a few other applications that do much the same thing. The main benefit for this option is that it is Qt and that’s fairly universal these days.

Also, it looks pretty cool if you’re looking at the entire drive with it. This picture isn’t really of any value, it’s just because it looks neat. Call it a bonus picture!

Full drive view with QDirStat
This picture serves no purpose, but the colors are pretty!

Closure:

If you’re curious, I used the QDirStat because that was what I had installed and ready to go. It didn’t take very long to figure out where the problem was. Once I knew where it was, I cracked open the terminal and removed the offending directory and the contents within. I then removed the offending cron job, with a note to myself to fix it later today. This resolved my problem quickly.

Had I tried to find it visually through the file manager, I’m quite certain that it’d have taken quite a bit longer. The name of the directory didn’t make it seem out of place. In fact, I’ve had a ‘kgiii’ directory right there in my home directory in the past. I stopped doing that when it got confusing, so now it’s a ‘tmp’ folder, though I digress. The point is, I’d have taken quite a while to figure this out had I not had the tools to hand and known how to use them.

Finally, I have a ton of notes from which to write articles, but sometimes real life gives me an idea for a different article, such as this one. If you have an idea for an article, you can go ahead and write it. You can also unblock ads, donate, sign up for the newsletter below, leave a comment, and more! Thanks for reading!

What it’s Like To Beta-test Linux, Specifically Lubuntu

You may not think so, but everyone can meaningfully help their favorite distro. Someone has to beta-test Linux, and most everyone can do so. Here’s one way that you can help.

You don’t have to be a programmer, being able to code isn’t mandatory. It’s not even a requirement that you have spare hardware to test with. Going gung-ho and testing daily isn’t even a requirement. You just need to have some time that you’re willing to give back to the projects that have given you so much.

I don’t tend to do half-measures, so I’ve thrown myself into the task. The amount of learning I’ve done since starting is probably the most I’ve done since I was just a Linux beginner. If you like learning, then your ability to help knows no bounds.

Why I Beta-test Linux:

About a year ago, I learned why Ubuntu stopped offering 32 bit versions. It wasn’t because 32 bit was old, nor was it because the devs hate 32 bit systems. The reason they stopped supporting 32 bit systems was because there were too few people willing to test on 32 bit systems.

Now, I don’t actually use any 32 bit hardware. In fact, I haven’t used 32 bit hardware since pretty much the first day 64 bit hardware hit the market. I had empathy for those who had to move to a shrinking pool of distro choices. I also realized that it could happen again, for other hardware or software.

That’s when I realized that I could do my part. It is when I decided that I’d look into the process. After some investigation, I made it known publicly that I’d be testing. By making the claim that I’d do so, it forced my hand into actually following through. The claim was made to them as much for their sake as it was for mine.

I’ve done it ever since. It takes maybe an hour per day to do it, and to do it well. I test on at least two different pieces of hardware, file my reports, and go on about my day. Sometimes I get more involved and test other things, but my usual activities are just testing the daily build.

How I Beta-test Linux:

This will, of course, be different for you – unless you want to beta test Lubuntu. In which case, this is pretty much how you’d do it. Though your method may still be different. My testing is “just” the live instances of Lubuntu.

The live testing is actually the longer of the two types of tests. If you’re doing the installation tests, you basically just install and make sure it reboots, perhaps ensuring internet connectivity works out of the box. If nothing breaks, you’re done.

Every day, at about 13:30 my time, I start refreshing the testing tracker URL. (That link is time sensitive. It won’t be the same for the next cycle. It’s largely for illustration anyhow.) What I’m looking for is the date to change on the download. When that changes, I know there’s a new daily build for me to test.

You don’t actually have to do this every day. You can do it when you have time, or closer to the end of the release cycle. You set the time and schedule.

When the date changes and there’s a new daily build, I use the zsync option to save bandwidth. Using zsync means I’m only downloading the parts of the image that have changed. I not only do this on one computer, I do it on another computer. As mentioned above, I test twice.

While I’m there, I also download the new manifest. The manifest is a list of all the files that are in the image (.iso, of course) and I use it to ‘diff‘ against the previous manifest. This tells me what has changed and what needs more attention and testing.

It’s at this time that I start filing my reports. Those will vary and depend on what your distro of choice is using. Mine are generally pretty basic and short, unless I find something amiss. If there’s something amiss, then that requires proper testing and bug reporting. That happens with less frequency than you might imagine, but it’s essential that you follow conventions and properly report bugs in a manner that the developers can use.

Later, those reports get closed, using a process where I mark the test as ‘in progress’ while testing and then close them as passed or failed when I’m done. Each report contains a list of existing bugs and any newly found bugs.

The Actual Beta-testing Linux:

When the two files are downloaded and reports opened as in progress, I’m ready to actually begin. On one machine, I’ll start writing the daily .iso to a USB drive and on the other I’ll use it to start a fully prepared virtual machine.

The testing done on both is remarkably similar. I also undertake the live testing and, as I said near the top, that one takes the most time. You’ll see why…

As I’m testing the live instance, the first two things I check and change are the screen resolution and the keyboard layout. Those will be the first two changes people are likely to make in a live environment, and so they’re the first two things I change and check.

The next task is checking the existing bugs. For example, there’s a bug in the terminal where it won’t actually open with the presets (two horizontal or vertical terminals). Another is a wonderfully odd LibreOffice bug that appears to have existed for quite a while before I noticed it. I’ll explain the LibreOffice bug and show it to you.

To trigger the bug, open every LibreOffice application up in order. If they stop appearing in the task bar after you’ve opened Impress, then you’re likely going to be able to trigger the bug. After they’re all opened, select the “Vivid” template in Impress – and watch all of the LibreOffice applications crash one after the other.

Watch, full screen should work if needed:

This particular bug was discovered because of how I do the testing. Nobody seems to know what the cause is and it doesn’t appear in every distro – but it appears, or manifests itself in some way, in a variety of distros. (I’ve tested, of course!)

So, once I’m sure that the existing bugs are still there, I do the rest of my testing. This means I open the menu, start at the top, and open everything. I don’t open them all at once, I open them by segments. First, I open all the Accessories, then Internet, then Graphics and Video, etc. applications at once. I make sure they all open and that they all close.

When there is a change noted by the diff I mentioned earlier, I make sure to check that application even more. I also pick a half-dozen, maybe a dozen, other applications to test more thoroughly. For those, it isn’t just checking to see that they open and close, I check that they do things like open the appropriate files, their preferences work, and that the application does the job it was meant to do.

Most of the time, there’s nothing doing. It’s exactly the same as it was the day before. Those days are the easiest. You just file the reports and you’re done for the day. If there are new bugs, you have a bunch more work to do. 

In the case of a new bug, you need to file a proper bug report. More importantly, you need to make sure it’s a bug. To do this, you’ll test against everything you can think of. You’ll even test against other distros to see if the bug also exists in those distros. It is also worth installing the beta (preferably in a VM) to test to see if the bug is in both the installed and in the live instance. You want to narrow it down as much as you can, making it easier for the devs to fix.

The forms and paperwork you’ll be doing will vary. They won’t be just like the Lubuntu system, which is based on the Ubuntu system. You’ll need to connect with someone on the team, someone familiar with the process, to make sure you’re doing it right.

In my case, I call my connection my ‘mentor’, though that can sometimes be a formal term. They’ll need to be someone you get along with, because you’re going to interact with them fairly often as you learn the ropes. You’ll need to be patient, as they’re not always available and often have other tasks that they’re working on.

From my observations, you’ll really enjoy it. The people involved in these projects are all just humans. They want you to help. If you don’t want to beta-test, just let them know that you have some free time and let them know what skills you have in your toolbox. There’s always something you can do.

They may find a niche for you doing documentation, doing bug triage, answering support questions, keeping track of task-completion, or any number of things. Just contact the distro team, let them know you want to help, and they’ll find a use for you.

Closure:

You can make a meaningful difference. By taking part, you can make your favorite distro even better. It needn’t be a distro, it could just be a project you use and understand. The people writing ‘inxi’ can use your help, ‘Shutter’ too, or even ‘GIMP’ or ‘Blender’. Pick one and jump right in!

Seriously… Getting involved is easy! Even if it’s just you noticing and reporting a bug, you can meaningfully impact the software that you use every day. You can make a difference, and you can make it better.

The amount of time you donate is up to you. It needn’t be quite like the one to two hours I spend daily, it can be just a couple of hours a week. The choice is for you to make and it needs to fit your schedule.

As always, thanks for reading. Don’t forget that you can unblock ads, donate, write articles, and sign up for the newsletter. You already know that I appreciate the feedback. There will be a new article in just a couple of days.

A Few Ways to Determine Which Distro and Version You’re Using

This article will show you a few ways to determine which distro and version you’re using. There are many ways to learn this, but these are three easy ways to tell.

There are any number of reasons why you might not know this information off the top of your head. Perhaps you’re working in a multi-platform job? You might have many devices. It’s possible that you may have a bunch of virtual machines, each different. One can’t always tell by just looking at the desktop, especially if you’ve done any customizing.

Additionally, you may have upgraded and not know things like the point release. You may have different versions across your network, each for its own purpose. You might just be forgetful and so you’ll need to determine the distro you’re using, as well as which version of that distro you’re using. You might be in a position where you need support, and being able to share this information is essential.

No worries, there are a few easy ways to determine which distro you’re using. All of them are pretty easy.

Determine Which Distro (and Version):

All of these methods will rely on the terminal. So, before you begin, you can open your default terminal emulator by using your keyboard and pressing CTRL + ALT + T.

Once you have that open, you can try any combination of the following:

Method #1

The first method will involve a program known as ‘neofetch‘. Many distros actually provide this by default. If not, it’s probably in your default repositories and you can install it pretty easily. For example, with a Debian-based, or APT-using distro, the command to install it would be:

Once installed, you can simply run it with the name of the application. No modifiers are required. You simply run:

You’ll get an output similar to:

neofetch in action
This should be entirely self-explanatory. You can do more with neofetch, by the way.

See? Nice and easy. The information to determine which distro you’re using is right there in the output and on the top-most line.

Method #2

The following two methods need no additional software. You simply need to run the command in the terminal. 

The first of these two methods is:

Which will give you an output similar to:

Again, this is self-explanatory. The top-most is the major name, the second is the version, then the release number, and then the codename. With this information, you can determine which distro you’re using.

Method #3

Your distro may not have any LSB data and may not contain that information. That’s okay, there’s still one more command for you to try. Again, you don’t need to install anything, it just works out of the box.

This time, the command you’ll be running will be ‘cat’ and you’re looking for release data in the /etc directory. The command looks like this:

Your output should look similar to this:

As you can see, that contains a ton of information, including where to go for support and where to file bugs. 

Closure:

One of those is bound to work for you. I checked across a number of virtual machines and was able to determine which distro each was using. In many cases, all three of them will work for you.

At the end of the day, you can probably just pick your favorite (or the one that works) and commit it to memory. Personally, I try the ‘lsb_release -a’ first, as that one is firmly locked in my memory.

Like always, thanks for reading. I love the feedback folks provide, either here or at one of the sites I frequent. You may have noticed that I am now the owner/moderator of the LinuxTips Reddit Sub. If you frequent Reddit, and you’re interested in helping out, just drop me a note on Reddit and I’ll get you set up as a moderator there.

Of course, you can also unblock the ads used here. You can sign up for the newsletter. You can donate or write an article. There’s a few ways you can help keep this site going, or show your support. I currently write a new article every other day, though I’ve been considering increasing the frequency. Either way, let me know in the comments what you think of any of this stuff. I’m always curious about your thoughts regarding this site.

How To: Sanitize Exif Data From Your Digital Images For Privacy Sake

When you take a digital picture, the resulting file contains potentially personal information. It is known as ‘Exif‘ and it contains sensitive information. This article will explain how to sanitize Exif data to avoid leaking your personal information.

If this article looks familiar, I’ve previously authored an article on this subject. It’s at the old site, which will be redirected here. I might as well write it anew, using the current style.


UPDATE: I received an email one Morgan Kinney, inviting me to review and include a link to a study they (authored by one Paul Bishoff) had done regarding Exif data and the privacy implications. If this article wasn’t clear enough about the privacy aspect of sanitizing Exif data, then please consider reading the following link:

EXIF metadata privacy: A picture is worth a thousand data points

I’d not normally do this, but their work is well done and is a worthy addition to your understanding of Exif data and the privacy risks associated with Exif data. See the “Closure:” section for more updated information.


Moving on…

Exif is the additional information included in the file your digital camera makes, among other things. It can be as benign as color correction data to orientation settings. In some cases, it can also contain such privacy-wrecking gems as when and where (the GPS coordinates) and when  the picture was taken. It is defined as thus:

Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras.

The Exif data can even contain information about the camera’s brand and, as you can see, isn’t limited to just a fancy digital camera. Your other devices, from smartphone to scanner, add this extra data to the file. Anyone who is aware of this can easily look for this data. Exif data has even been used as evidence by the judicial system.

Obviously, there are huge privacy implications with this. You can probably minimize some of the data that’s created by changing your phone/camera’s settings. That does nothing for existing files, and nothing for when your device has no such configuration options.

Let’s See This Exif Data

There are any number of ways to examine the Exif data. For example, this is some of that data and it is being drawn from a program called XNViewMP.

Exif data
Exif data sample. There’s not a whole lot of data with this one.

That one tells you how old the picture is, and not a whole lot more. But, it also now contains the information about the last time it was accessed. That could be of interest, perhaps giving away things like the age of the photo’s subject.

This next picture is the Exif data from one of my cellphone pictures. I have the GPS data turned off, so that wasn’t included. You’ll see a ton of additional information.

More detailed Exif data.
See? Now you can tell I don’t bother updating my phone often.

As you can see, there’s even more data in that file. There may well be even more data in your pictures. It tells you what camera I was using (a cell phone, and an old one at that) and that I took the picture at 14:30, in a well lit room. It even tells you the software version, which may be exploitable to an attacker.

Don’t worry too much about this. It’s a solved problem. You can sanitize Exif data and maintain a bit more privacy. It’s actually remarkably easy.

Many image hosting sites will automatically strip the Exif data when you upload your image.

Let’s Sanitize Exif Data

The tool we’re going to use for this is ‘exiftool‘ and it’s pretty simple. It’s quite likely already in your default repositories, or at least the repositories you can add trivially. In Debian/Ubuntu/Mint/similar, you can install it with:

You’ll need to adjust the command for your distro, of course. Once you have it installed, you can navigate to the directory where you store your images and run something like this to sanitize png files:

Or, if you’re trying to sanitize .jpg images, you’d run this command:

Depending on the number of files in the directory, it could take a little while to run. It’s pretty speedy and it does give you confirmation when it’s done. I’ve used it on large numbers of images at once and it took care of them all in less than a minute. I probably should have paid more attention, that way I’d have some actual numbers for you.

NOTE: The exiftool can actually strip data from other files, including files like PDFs and other such types of documents. A complete list can be found here. Yes, those documents contain data beyond that of the text contained in them. They may contain such data as the computer name, username, and dates and times of file creation and editing.

Personally, I combine both the .png and .jpg commands into one command and I run that command with an alias. We haven’t covered aliasing yet, so I’ll just go ahead and show you what I use.

That, if added to .bash_aliases, would let you use ‘picclean’ to sanitize an entire directory’s worth of png and jpg files. It comes in pretty handy if you’re sharing a bunch of files and want to make sure they’re all clean before you send ’em.

Closure:

Well, there you have it. Hopefully you’ll now know a little bit more about how to sanitize your image files, removing the private data from them as much as you can. If you don’t generate the data in the first place, you don’t have to delete it. So, disable embedding GPS coordinates in your phone (or some fancy cameras) and don’t take pictures of yourself while doing illegal activities.

UPDATE: As mentioned, I’d not normally do this – but there are exceptions. I don’t mind linking to other sites if the content is worth the attention of my readers. If you have your own content and would like to have it referenced here, don’t be afraid to contact me. Just be aware that I decline about 60% of these sort of requests. While I do love guest additions and guest articles, no I won’t be including articles about mortgage rates and the benefits of CBD oil. My readers aren’t interested in articles like that. So, your content needs to be both good and topical.

Thanks, as always, for reading. I always look forward to the feedback, here and on other sites. Don’t forget that you can unblock ads, sign up for the newsletter, donate, or contribute by writing an article or two. Don’t forget to share this site with your friends. Share the love!

UPDATED: (Updated on 01/23/2022)

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