Change Your Timezone In Linux

Today’s article is an easy one about how you can change your timezone which isn’t something you’ll likely need to do all that often. It’s not all that complicated, though it can look like it is. It can be a bit tedious, but that’s just at first blush. I’ll show you how to make it a bit easier.

NOTE: This is actually a duplicate. I wrote it some time ago and realized it was a duplicate, or reasonably close to another article. I decided to save it and publish a duplicate article when an ’emergency’ came up. Well, we have an ’emergency’. I had too many adult beverages before it was time to write a new article. So, you get this one.

Now, the title is obviously not correct. You’re not going to change your timezone, you’re going to change the timezone settings your computer is using. Alas, headlines aren’t to be all that long and are allowed to make some assumptions. If you want to change your timezone, you’ll have to move.

This article is only useful to you if you use systemd.

My regular readers may have noticed a giant outage. Linux-Tips.us was unreachable for a good part of the 6th. My initial assumptions were that we’d been hacked, that is that WordPress had become compromised. That’s a reasonable assumption.

It turns out that we’d been moved to a new data center. We’re now located in New York. I use a CDN that relies on an IP address. There are a bunch of DNS records behind the scenes. Those records had to be updated. That wasn’t a major task, but troubleshooting the problem was the challenge.

Everything turned out okay and I won’t even miss a scheduled publication. Of course, I’m writing this at 04:45, but you will have your article today. So far, I haven’t missed a publication date. I’m quite amazed by this.

Speaking of today’s article, we’re going to be learning how to change your timezone. We’ll be doing this in the terminal and the tool we’ll be using is known as timedatectl. If your distro uses systemd, you have this installed. When you check the man page (with man timedatectl) you’ll see that timedatectl defines itself as:

timedatectl – Control the system time and date

As you can see, this is probably the right tool for the job – assuming the job is changing your timezone. Seeing as that’s what the title says we’ll be doing, we might as well do that.

Change Your Timezone:

As mentioned in the introduction portion of this article, you’ll be doing the work in the terminal. It’s often easy to open a terminal with a keyboard shortcut. Frequently, you can open your default terminal by just pressing CTRL + ALT + T. Otherwise, look in your application menu. That’d be a good spot to look for a way to open your terminal.

With your terminal open,  you can enter the following command to see what you have for your current timezone settings:

Before you can change your timezone you have to know what time zones are available. There are a whole lot of them, meaning you can be scrolling for quite a while. Go ahead and enter this command:

(You can press CTRL + C to get out of that.)

So, what we’re going to do is narrow down the results shown to you. You’ll need to know the region you’re in, such as Europe, Africa, America, etc for this next part and we’re going to use a pipe and grep (which we’ve used in the past). For me, I’d want to set my timezone to New York in America and my command would look like:

You’ll note that this is case-sensitive. Listed in the output would be the text I’m after, the text needed for the command that lets you change your timezone. It looks like this:

With that information available, I can now complete the command to change my timezone to that of New York. That command is easy enough. It just looks like:

Or, when using my location as the example, the command looks like this:

It’s not too daunting a task to change your timezone. If you entered the wrong timezone during installation, you can trivially change it to the correct timezone.

I should mention that your computer will use NTP to keep your system’s clock set. This is also stored in your system’s hardware. The CMOS battery keeps that and other settings stored while the power is disconnected. This battery can go bad.

If that battery does go bad, you may find yourself setting the date and time of your system every time you start your computer. NTP should then kick in and keep your system’s time updated. For reasons deeper than this blog will go, your system depends on time (specifically Unix Time) in all sorts of applications.

Closure:

Well, there was some drama. The site was down for an extended period and this article wasn’t written until the wee hours of the morning. However… However, I didn’t miss a publication date. Also, I just realized I haven’t done a meta article in a while.

With some great help from the hosting company upstream, everything was resolved and you got an article about how to change your timezone in Linux. All’s well that ends well.

While there are backups, my heart sank when I thought that the site had been hacked. Cleaning that mess would have been tedious. Fortunately, that wasn’t required. No data was lost and we can move on knowing that it’s just a footnote in the site’s history.

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.

Access Recovery Mode On Ubuntu

Today’s article shouldn’t be too long, but covers something important, which is how to access recovery mode on Ubuntu. If your Linux system has problems, you may need to access the recovery mode in order to fix it. This shouldn’t be a very long article, and I don’t think it’s all that complicated. Others may view this as complicated, but it seems pretty basic to me.

It isn’t all that complicated a process, but it’s something you should memorize, just in case you have no other way to access a search engine to learn this information. This is one of those skills you really ought to know by rote. It is one of those things about Linux that you probably should have memorized. 

What is Recovery Mode?

When you boot to recovery mode, you’ll be given a choice of booting to any of your currently installed kernels. The system then boots with the minimal amount of resources and mounts the root partition as read only.

You might be interested in a recent article on the subject of multiple kernels:

Show Installed Kernels In Ubuntu

Recovery mode lets you access the system to troubleshoot problems. It probably isn’t a necessary step for most issues, but it’s a necessary step that you will want to take if your desktop isn’t otherwise loading. If you’re unable to get to the GUI desktop, you should try recovery mode.

You can also try previous kernels by doing this. Recovery mode is just one option you’ll have from the GRUB menu. You get to pick your other kernels and even enter a text mode to work on your system via the CLI. For most folks that have had the kind of difficulties that stop the GUI from loading, trying recovery mode is a good step to take.

This may very well work in other operating systems. I’m being specific to Ubuntu because that’s what I have pictures for. Well, technically I’m using Lubuntu in a VM to get the pictures, but this should work for all sorts of distros. Do me a favor and leave a comment if you know this works in other distros. It’s way too late in the day and I don’t have time to check.

Access Recovery Mode On Ubuntu:

Well, you don’t need a terminal for this exercise, but you do need to reboot your computer. I suppose we can do this from a terminal, if you really want. You can just as easily use the GUI, or you can close things down gracefully and then run the following command in the terminal:

BEFORE YOU DO THAT…

We need to know if you are using EUFI/EFI boot or if you’re using the legacy BIOS mode to boot your computer. Fortunately, I’ve already covered this!

How To: Tell If You Are You Using UEFI or BIOS

Now, when your computer reboots, it’s going to perform a quick POST (Power On Self Test). That’s the point when you can decide to just let it boot or decide to enter a temporary boot menu. These shouldn’t be confused. If you’re interested in accessing your temporary boot menu, read this article:

How do I ‘Boot to USB’? (Or CD/DVD, if Such is Available)

As soon as POST ends and the OS starts to load, there’s a very brief window of time when you can press a key and access the GRUB menu. Trust me, this works. You may have to try multiple times before you get the hang of it, but this 100% works.

If you have a working keyboard, this works. You just need to time it right. You can try pressing and holding the right key as soon as you reboot, or you can try tapping the key over and over again. Should you have issues getting it right, check your settings for “Fast Boot” and temporarily disable that to give you more time.

If you’re using UEFI, the key you’ll press is the ESC key.
If you’re using BIOS, the key you’ll press is the SHIFT key.

Assuming you’ve done this right, you’re now at the GRUB menu…

The GRUB Menu:

GRUB stands for “Grand Unified Bootloader” and is what you’ll be seeing (and using) on a stock Ubuntu configuration. There are other bootloaders out there, but we’re assuming you’ve not changed from the default.

If you’ve done the above steps properly, you’ll see a GRUB screen. If you haven’t done this correctly, you’ll see the splash screen as the operating system starts to load. When you see the splash screen, you might as well just reboot so that you can try this all over again.

The first screen you’ll see will look like this:

the grub boot screen
I’ve highlighted the choice you want to select with your arrow keys and enter button.

As indicated, you want to select the advanced options for Ubuntu. Of course, that won’t be the case if you’re using a different distro. You’ll want to pick the advanced options for that distro.

Finally, you need to select the correct option to access the recovery mode on Ubuntu. It’s really obvious, but here’s a handy picture:

grub option to pick the recovery mode for ubuntu
You can see that you can also select the recovery mode from an older kernel.

Once you’ve done that, and with any luck, your computer will boot to the recovery mode, and you’ll have learned how to access recovery mode on Ubuntu. You can see the option to boot to an older kernel is there as well. That’s another useful tool to have in your Linux toolbox.

Closure:

Well, if everything goes perfect (and it seldom does), you won’t need to access recovery mode on Ubuntu. It’s just not something you’ll need to do. But, if things don’t go perfect – and we tend to tweak, modify, and break things as Linux users, you do have a recovery mode, and it’s not too hard to access it. Of course, what you do once you’ve entered recovery mode is up to you and will depend on your problems, but you now know how to access it.

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.

Show Installed Kernels In Ubuntu

Today’s article should be fairly short and straight to the point, as we discuss how to show installed kernels in Ubuntu. This isn’t a very complicated thing and we’ll be showing these kernels in the terminal. Sure, there are GUI tools you can use, but you might as well learn to do this in the terminal.

A lot of people ask the question, “What is Linux?”

Well, Linux is just the kernel. The kernel schedules tasks, interfaces with hardware, and generally manages the stuff that goes on at a lower level. This is surrounded by GNU’s tools and you will generally add a window manager and desktop environment on top to turn it into a useable desktop system with a fancy GUI.

You might enjoy reading this article:

The “Linux” or “GNU/Linux” Debate

Under all that is the kernel. It’s very important! Without it, we’d have no Linux. There are other kernels out there, but the topic of this site is Linux Tips. But, without a kernel, your computer would be dead in the water. 

In the course of updating your system, and depending on how you do your updates, you’ll install new kernels as they are released. GRUB will default to the newest kernel in most configurations, but there are other kernels installed and those can be selected from an advanced menu during the boot process.

Unless you have a brand new install that hasn’t been updated recently (kernel updates are common), you’ll have more than one kernel installed. Even if you upgrade Ubuntu in the terminal, even if you use ‘autoremove‘, Ubuntu will store the previous kernel. This is a good thing, as you can boot to that kernel if the new one should give you trouble.

It’s sometimes necessary to wait out a kernel version because it doesn’t run properly on your system. That’s not common, but it does happen. When that does happen, you should update manually and control what software is removed so that you don’t remove the working kernel and can still have a usable system. It happens, it’s just not all that common.

By the way, the kernel is mostly worked on by paid developers these days. The current kernel has more than thirty million lines of code. Of course, it contains drivers for hardware new and old and those folks using the older equipment will scream bloody murder if you remove their drivers from the kernel. Still, stuff gets culled regularly – it’s for the good of the herd! Maintaining all that for three users is asking too much.

What have we learned?

We’ve learned that the kernel is important and kind of what it does. We’ve also learned that you have more than one kernel installed. Additionally, we’ve learned why that’s a good thing. So, we’re doing okay so far!

Show Installed Kernels In Ubuntu:

As the first paragraph said, you’re going to need an open terminal. This is true for most of my articles. You should know how to open a terminal by now. If not, press CTRL + ALT + T and hope for the best! That keyboard shortcut is not quite universal, but fairly close.

These instructions are going to work in Debian, Ubuntu, Mint, etc… At least one of them may work for other distros. I can’t say that I’ve tried recently and I’m not going to make any claims. Where we use ‘dpkg‘, that’s going to be exclusive to those distros with dpkg – the Debian Package Manager.

Seeing as I mentioned dpgk, we can start with that command first. If you want to show installed kernels in Ubuntu using dpkg, the command is simply:

That might look something like this:

showing the installed kernels in Ubuntu
See? There are multiple kernels installed at this point on this particular system.

If you search the ‘net, you’ll find there are all sorts of ways to do this – including some fancy commands that use egrep and show colors. I don’t see any reason to include those. What we have here works.

If you want, you can also use the find command. That’s a nice and handy command and I suppose this command might work on other distros. To show installed kernels in Ubuntu using the find command, try this command:

That should list your installed kernels quickly and without any fuss (and no muss). There are all sorts of ways to find this information but we’ve just covered the two quickest and easiest ways I can think of (in the terminal). It’s probably quicker in the terminal than it is for any other method, especially if you’ve always got an open terminal (or three).

Closure:

Well, there you have it… You have learned how to show installed kernels in Ubuntu, a useful skill to have (especially if you’re having kernel issues). These are easy enough to remember commands, or you can always use this site’s search function to find what you need. I do that myself. I’m always referring to articles I’ve written and the search function isn’t great but it does 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.

Generate Random Numbers

Today’s article is going to be more or less an intellectual article, as there isn’t much need for folks to generate random numbers. It’s just a fun article that will show you a neat trick you can perform in the Linux terminal. If you’ve ever wanted to generate random numbers, this just might be the article for you!

First, let’s say a few things…

One, this is not true random. True random is something you’re not going to get with a computer. While Bell’s Theorem insists that true random exists in the universe (such as the rate of decay in a radioactive isotope), it’s really hard to achieve randomness.

Instead, we rely on pseudorandom – and we rely on it a great deal. Cryptography relies on it as much as a security certificate. They all deal in randomness and there are different degrees of random. What’s important is predictability.

While I’d love to turn this into a giant mathematical discussion, let’s just agree that you’re never going to get true randomness from your computer. But, we can also agree that you’ll get results that are random enough for our purposes.

Even with security certificates, we do not have true random as our backing. However, it’s random enough for advanced certificates to be reasonably unbreakable at this time. Trust me, I’d love to make this a geeky discussion, but for our purposes just accept that there’s a spectrum between predictable outcomes and true random. Everything you’re ever going to approach is going to be on that spectrum.

If you want true random, there’s random.org which claims to generate truly random numbers based on atmospheric noise. (Basically, they’re using what you’d think of as static as a source for randomness.) I am going to highly suggest those interested view the following article from the random.org website:

Introduction to Randomness and Random Numbers

That’s going to be complicated for some of my viewers, but I have high hopes that some of my viewers will be appropriately ‘geeked out’ by the discussion. It takes true Philosophers of Mathematics to grasp the intricacies (and implications) of random, pseudorandom, and true random.

There are those (including myself) that are a bit skeptical of the concept of true random – but those, like me, accept the aforementioned Bell’s Theorem because it has been thoroughly tested and stands as being the most acceptable answer to our observations. We call this science and I’m a firm believer in the scientific method.

So, at this time, we have ‘conclusive’ evidence that true random exists in the universe. It’s just REALLY complicated and takes many pages of math to describe. After all, there are things like this:

Random numbers certified by Bell’s theorem (Nature)

And, for the truly daring, I encourage you to view the following Wikipedia article that delves into the theorem itself:

Bell’s Theorem (Wikipedia)

Trust me, all sides of this have been thoroughly discussed at the Muddy Charles Pub. People far smarter than myself have hashed this out over many pints, both from a mathematical and scientific viewpoint and from a philosophical viewpoint. After all, we humans have a nasty habit of claiming something is random while the reality is that our understanding is just incomplete. As such, randomness is a tricky subject.

We’ll be using the ‘shuf’ command in this exercise. It’s installed by default and uses both /dev/random and /dev/urandom for its output. The command is simple enough to use and suitable for making your own random dice generator for your next Dungeons & Dragons game. Given manufacturing discrepancies, it’s probably more random than actual dice. 

The ‘shuf’ command describes itself as this:

shuf – generate random permutations

Every distro will likely have this installed by default. If it’s not installed in your distro (check shuf --version to ensure it shuf is installed) you’ll need to install it for the sake of this exercise in generating random numbers.

Other than that, you won’t need anything but an open terminal…

Generate Random Numbers:

If you can’t tell, this is a subject I’m passionate about. Many of you will know that my background is being a mathematician, albeit retired. To me, the subject of randomness (and I hope to have given you a taste) is fascinating. This won’t be true random, but it will be fun. So, let’s just press CTRL + ALT + T and get that terminal open.

With your terminal open, the syntax of the command is as follows:

If you execute that command, it will list every number between those two values (lowest number and highest number) in random order. For example:

If you only want a few random numbers, the syntax would look like this:

For example, you might want to get three random numbers between 1 and 20. That’s easily done. You’d simply use this command:

An example of that output might be:

So, if you wanted to replicate a 3d6 roll (three die six) with a single output would be done like this:

Of course, if you wanted to be fancy for your D&D-playing friends, you could expand the command. (I rolled an 18 on my first try!) See this:

See? Good times! If you want to generate random numbers (for a fun definition of random, and a truly useful random) you can do so quickly and easily from right there in the Linux terminal.

Closure:

Trust me, this is the short version… I wanted to write more about randomness. I have a love for mathematics that I suspect isn’t shared by many. I know it isn’t shared by many – and there’s a reason for that but this isn’t the site or topic to get into that. (Hint: It has to do with how mathematics is taught at an early age.)

So, for me, random is a special subject – much like infinity. These are concepts to be mulled over and considered. They are ideas that we’ve taken and made real. Even if they didn’t exist (and infinity still doesn’t exist), we’d use them as concepts, which is good enough for the real world.

These are concepts that are as old as mathematical and logical thinking has existed, as math is just logicism at its core. They’re like a fine wine, sipped at and quantified – but never quite fully understood. And that’s okay. For us, we sip and dine at the table of logic, using what tools we have to appreciate the experience.

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.

Increase The Volume Of Thunderbird Notifications

Today’s article is one of a personal nature, an issue that affected me personally, where I needed to increase the volume of Thunderbird notifications. It was a bit of a problem and one easily resolved – at least in my case. I think it will be trivial to overcome this for others and thought that I’d make a quick article about this.

Thunderbird is an email client. The Thunderbird email client is brought to you by the same people, that is Mozilla, that brings you the Firefox web browser. As far as graphical email clients for Linux goes, you’re probably better off using Thunderbird.

This article is specifically about the calendar. It is only applicable if you have the calendar (sometimes called Lightning) installed. Further, it is only applicable if you then also have it set to chime an audio file when a scheduled activity is due. If none of those things are true, this article is not meant for you.

I don’t allow most audio notifications, but I do rely on Thunderbird for scheduling and noting appointments. If you’ve configured Thunderbird to show notifications and to create a sound to denote those notifications, you may notice that the notification is quieter than you’d like.

I searched for a solution for the low volume of Thunderbird notifications. I had a solution in mind, but I looked for something more graceful. The goal was to find something ‘in-app’ that let me set the notification volume. Not only was I unable to find a solution in that direction, I was unable to find anyone suggesting this path to increase the volume of Thunderbird notifications.

I’ll be giving directions for Debian (and derivatives such as Ubuntu, and all official Ubuntu flavors, Linux Mint, ElementaryOS, and such) but you can adapt these directions for your needs. The tool we’ll be using is ‘Audacity’ and that’s probably going to be in everyone’s default repositories.

If you’re unfamiliar with Audacity, the application is used to edit audio. As a general rule, I don’t bother with full-fledged DAWs and prefer the simplicity that Audacity offers. So, I guess that does make it my DAW of choice.

Odds are good that you don’t have Audacity installed by default. Again, assuming you use a distro with apt, you’d simply install Audacity with the following command:

If you’re curious, the man page describes it like this:

audacity – Graphical cross-platform audio editor

That’s a fine description and Audacity is the only tool you’ll need to increase the volume of Thunderbird notifications. As near as I can tell, this will work on default sounds or the sounds you add as your notification sounds.

So then, let’s get on with it… Let’s learn how to…

Increase The Volume Of Thunderbird Notifications:

If you read the intro correctly, or at least as how I expected it to be read, then you should have already installed Audacity. You can do this with any DAW (Digital Audio Workstation) but Audacity is quick and easy, easy enough for me to use.

So, I’ll assume you have Audacity installed.

You can do this with Ocenaudio. If you want a full-blown DAW, you can do this in Reaper. You have choices, but these directions are for Audacity.

Your first step is to open your file manager. With your file manager now open, double-check in Thunderbird to see where your notification sound file is located. It’s in the Settings menu, under the Calendar settings.

Thunderbird's notifications settings.
This should be fairly easily explained. A picture is worth 1,000 words!

As you can see, I’ve chosen a custom audio file. The process is the same. You need to find the file in question or add your file. If you wanted to you could root around and find the default file, but I suggest adding your own.

Once you have found the sound file, right-click on it and open it in Audacity. You can also open Audacity and then open the file by clicking on File and then Open. Both should work on most distros.

You’ll then see a screen that looks similar to this:

We'll increase the volume with Audacity.
That’s the waveform of my ‘cymbals’ notification chime.

What you do from here is right-click on any part of the spectrum shown in the image above.

You then press CTRL + A to select the full file.

You next click on Effect and then you click on Amplify. Adjust the amplification to suit and use the preview button to judge the volume level you’d like to achieve. That screen would look something like this:

Using Audacity to control the reminder sounds from Thunderbird.
If you want to hear your Thunderbird notifications easily, this is how you do it.

This works with more than just increasing the volume of Thunderbird notifications. You can raise and lower the volumes of almost any sound file quickly and easily. Rather than mucking about with some Thunderbird extension, you can just raise the volumes yourself.

Closure:

I’m not sure how many folks will be helped by this article, but I hope it’s some. This was an itch that I needed to scratch and this was how I went about doing so. I figured I’d share that with you by making it into an article. That seemed like a reasonable choice at the time.

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.