What You Need To Know About Linux’s Magic SysRq Key

The magic SysRq key can help you deal with a frozen and unresponsive system. It avoids doing a hard reboot along with, hopefully, avoiding potential loss of data. The SysRq key is actually a handy bit of knowledge to keep handy.

NOTE: The information in this article is for those who use the QWERTY keyboard. If you use Dvorak, AZERTY, etc., be sure to click the link in the opening paragraph because it will be different for you.

There are times when your system appears frozen but it actually isn’t. You can test this situation with the Shift Lock key. If the light (assuming you have one) comes on, the system isn’t technically frozen – it’s probably just not accepting inputs. But, if it’s so far gone that the light doesn’t change then it’s possible that this will not work.

There are all sorts of reasons why your system may appear to have halted. This article has nothing to do with that, nor is it about preventing a frozen session. It’s about using the magic SysRq key to get out of a situation where your system has stopped responding. 

The purpose, at least as far as this article is concerned, is to reboot without corrupting your data. This gives you a tidier reboot that reduces the risk of data loss. It’s quick and easy to learn and memorize.

The SysRq Key:

Look at your keyboard. Look carefully. The key we’re looking for is the ‘SysRq‘ key. You may not know why it is there, and may think it has no purpose, but it’s there and there for a reason.

The key is often doubled with the PrtScr (print screen) and doesn’t get used often. It’s used in combination with the Alt. If you’re using a keyboard with an Fn, you don’t normally need to use it to perform this keyboard function. Look around your keyboard and you should find the SysRq key. It’s bound to be there somewhere!

What you’re going to learn and is ‘REISUB’. This is easy to remember, because it’s ‘BUSIER’ backwards. When your computer is no longer responding, press (and hold) Alt, while holding SysRq, and then press R E I S U B in order shut everything down properly and reboot without (or with less chance of) data loss.

You can try it right now. However, you’re going to reboot if you do so. Leave about a second between each keypress.

You don’t actually need to use all the letters. If you give zero poops about data loss, you can go straight to Alt + SysRq +​ B​. But, that’s not giving the system the chance to perform all the shutdown processes.

If you want to (hopefully) not lose data, use REISUB. This is what those letters do:

R puts keyboard in raw mode.
E sends SIGTERM (except init).
I sends SIGKILL (except init).
S syncs mounted filesystems.
U (read-only) remount of mounted filesystems.
B reboots the system immediately.

Those should reboot the system for you, after sending all the other commands. Again, it’s easily remembered as being ‘BUSIER’ backwards and you should press them immediately after one another, allowing a second between each.

Closure:

This makes yet another article in the books, and now you know how to reboot your system when it is frozen. The magic SysRq key works well enough, even though there are some situations where it won’t work. A computer can be so frozen that it’s no longer accepting any input at all. It works well up until you’ve reached that point.

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.

How To: Rename Your Network Adapters in Ubuntu

For whimsy, or for whatever reasons you dream up, you may want to rename your network adapters in Linux. Well, you can. This article will explain how to rename your network adapters, from perhaps eth0 to whatever you want.

I can only be certain that this works in current Ubuntu LTS – 20.04, I didn’t test with any other distros. It’s pretty safe to assume that it will work with most distros out there.

Notably, I am just pulling this from my notes. I forgot why this is in my notes and I really can’t think of too many reasons why you’d need to rename your network adapters. Still, there’s at least one person who needed to know this information, else it’d probably have not been in my notes. It’ll almost certainly work with Debian, Mint, Pop!_OS, and others in that family of operating systems.

This article should be fairly short and will suggest the use of ‘inxi‘. As this article is based around Ubuntu, you can go ahead and install it with:

It’s a lightweight application that spits out a ton of information. I think it should be installed by default, but not all distros do. If you’re trying this with a non-Ubuntu distro, and one without apt, just adjust the installation method for your package management system. It’s almost certainly in your default repositories.

Rename Your Network Adapters:

The first thing you’re going to need to do is open your terminal. If you just installed inxi, you may well have your terminal already open. If not, you can open it with your keyboard. Just press CTRL + ALT + T and it should pop right open.

Once you have the terminal open, we’re going to use ‘inxi’ to get some information. The command you’re looking for is:

Specifically, you’re looking for the networking section. It should look a little something like this picture:

network information
Note the arrows. You need those two pieces of information.

You’re looking for the name of the adapter and the MAC address. You’ll want both of those bits of information, so you might as well keep that terminal open and open up another one. That’ll be easiest, as you can then just copy and paste the data in the next step.

Now, you need to create and edit a file. We can more or less do this with a single step. In the 2nd terminal, use this command:

Once that is open, you want to add some text to it. This is the template:

Now, to use that template, you insert the MAC address that you got from the inxi command where you see <mac_address>.

The <device_name> is a bit more tricky. It’s usually the first three letters – and don’t forget to leave the asterisk there. So, if you use my image above, you’ll see it’s wlo1. To change it, you’d just use ‘wlo*’. If it’s ‘eth0’ for your network adapter then you’d change it to ‘eth*’ being careful in all instances to keep the asterisk.

The last field to change is the name. You can stick anything you want in that field. So, for me, the command will look like this:

Yes, yes I really did name it booger. I’m pretty much a giant five year old.

When you’re done, save it. Just press CTRL + X, then Y, and then ENTER to save it with nano. As it’s creating a new file, it may ask if you want to create said file and you should (of course) say yes.

That’s it! Just reboot and you should see that you managed to successfully rename your network adapter. If it doesn’t work, double-check to make sure you got the device name and MAC address correct and reboot again. Done successfully, it looks like this:

renamed network adapter
Yes, yes I really did name it ‘booger’ – but only in a virtual machine.

See? It works!

Closure:

Again, I’ve only tested it in Ubuntu – so it’ll likely work with any Ubuntu derivative, should work for Debian, and will probably work with any other mainstream distro. I forget why it was in my notes, but I’m sure it was useful for someone. Maybe they just needed a name they could recall a bit easier, perhaps for their wireless connection and they wanted to connect to it in the terminal instead of keeping it always connected? I dunno… It was in my notes, it’s now online.

Either way, there’s another article. Thanks for reading! If you want to help, you can donate, register, write an article, or buy cheap hosting. When you scroll down, you can comment, vote for the article, or sign up for the newsletter. Should you sign up for the newsletter, I won’t share your information with anyone else and I won’t send you any spam.

How To: Find Your IP Address Through Your Terminal

The answer to the question, “What is my IP address?” can have different answers. In practice, you likely have more than one IP address. This article will explain how and will tell you how to use your terminal to find your IP address(es).

What is an IP address?

An IP address is a numerical designation given to computers on a network. This number is used to identify the computer. You can also identify a computer by their hostname, but the hostname is resolving to an IP address. Computers that are connected to a network will have an IP address.

There are two types of IP addresses to be curious about these days. There’s IPv4 and IPv6. IPv4 predates IPv6 and is still in use, but has run out of numbers. IPv6 solves that by enabling a whole lot more combinations. IPv6 has a potential of 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses – which is a whole lot of ’em, especially when compared to IPv4’s paltry ~4.3 billion addresses.

IPv4 addresses have technically already been exhausted, and have been since early 2011. The addresses still exist, but they’re all assigned to various entities. The IPv6 roll-out has been slow. Odds are good that you’re using IPv4 right now, in fact I know you are – as this site has an IPv4 address. Still, your router is likely handing out IPv4 addresses and your ISP is likely still using IPv4 addresses.

Additionally, in most cases, you would be concerned with two IP addresses. You’re likely connected to a router/modem that’s connected to the internet. As such, you will have a private IP address and you’ll have a public IP address. The first is (usually) assigned to your computer by your router and the second is assigned to your router by your ISP. This article will explain a little about each and how to find both of them.

Find Your Private IP Address:

Your private IP address will be in a reserved section of the IP address space. It will probably be handed down by DHCP (Dynamic Host Configuration Protocol), but many routers will both let you pick your IP address (from the reserved space) or will just assign the same IP address to the same device based on the MAC address (Media Access Control). 

The reasons you’d want to know it are your own, but it’s handy if you want to connect to a specific computer. As I know my laptop is 192.168.1.5, I can just SSH into it using that address. I know my media server is a different address, and I can connect to it with the IP address as well.

There are a number of ways to find your private IP address. I’ll share two of them that are quick and easy. For this, you’re going to want to open your terminal, which you can do by pressing CTRL + ALT + T and it should open right up.

First try:

You can also try:

In both cases, you look for ‘inet’ AND your device. You’re not looking for ‘loopback’, as that will likely list your IP address as 127.0.0.1 – which isn’t the address you’re after for reasons beyond the scope of this article.

You’re looking for your device, maybe named ‘eth0’ or ‘wlo1’ or similar, and then you’re looking for ‘inet’. Your IP address is the next four sets of digits (or alphanumeric combinations in the case of IPv6). For example:

example IP address
I’m not so sure the underlining matters.

One or both of those methods should work for you with any major distribution. There are surely many other ways to find your IP address, so feel free to leave a comment indicating how you do it.

Find Your Public IP Address:

The next kind of address is your public IP address. This is the IP address your ISP assigns you. If you wanted to connect to your computer over the world-wide-web, you’d be able to do so (with obvious caveats and proper configuration) with your public IP address.

It’s also the address I see (unless you’re using a VPN) in my server logs when you visit my site. That’s perfectly normal – as my site needs to know where to send the return packets. If my site didn’t know an address to send data to, it simply wouldn’t work.

You can think of this as the IP address assigned to the public side of your router, and your router then passes that information along via the private IP address that originated the request. This lets you have multiple devices using the same public IP address. (Read about NAT here.)

My understanding is that some ISPs are NATing public IPv4 addresses so that multiple routers can actually have the same IP address (not necessarily a good thing). However, that too goes beyond the scope of this article and isn’t want this site is actually about.

Anyhow, there are numerous public servers out there that you can ‘cURL‘ and those will give you your public IP address right there in the terminal. Just like above, you can open your terminal by using your keyboard and pressing CTRL + ALT + T. Once open, you can try:

Or you can try:

It should look a little something like this:

my public IP address
Yes, that’s my public IP address. No, I don’t care.

There are numerous other sites that’ll spit out the same info. The top-most example was recently handed over to Cloudflare, just so folks are aware.

Closure:

And, there you have it. You now know how to find your public IP address and how to find your private IP address from within the terminal. There are also many dozens of websites that will tell you your public IP address, but we might as well stick to the terminal for this one. Why not? You can do a lot in the terminal.

Once again, thanks for reading. Your comments and feedback help make the site better. As always, you can donate, write an article, sign up for the newsletter below, register, and vote to let me know which articles you prefer. If you sign up for the newsletter, you’ll get notifications when new articles are published. No spam, I promise!

Repair Your Linux Filesystem With a Live USB or DVD

It’s possible for your filesystem to become so corrupted that you can’t repair it easily. In that case, you can repair your Linux filesystem with a live USB or DVD.

Your filesystem may become corrupted for any number of reasons. One of the most common reasons is an improper shutdown, where your filesystem doesn’t have time to properly write everything to disk because it wasn’t shut down properly. You might see that sort of thing when you suffer from a power outage. 

There are any number of reasons why your filesystem will have become corrupted and, in most instances, your system will automatically repair your Linux filesystem when you boot your computer.

It’s also possible that a simple boot won’t repair your Linux filesystem. In that case, your OS probably has some sort of recovery mode and you can use that mode to repair your filesystem. 

Once in a while, your filesystem may have become so corrupted that you can’t fix it in recovery mode because you can’t get to recovery mode to fix it. Not to worry. This is something you can easily do with a live USB or DVD.

This article assumes you already have a USB or DVD with an OS that runs live. I’ll use Ubuntu as the example OS, as it’s really common. Adjust for your distro and you’ll be okay.

Here’s a link if you need to know how to access your temporary boot menu

NOTE: If you’re using Btrfs, you shouldn’t need to run fsck, it should heal itself. If not, here are Btrfs-specific commands that you should learn.

Repair Your Linux Filesystem:

The first thing you’re going to do is boot to the USB or DVD. You’ll need to be patient as the live instance loads into RAM. Once the OS has loaded to a GUI, you’ll want to select “Try Ubuntu”. (Remember to adjust that for your own distro, should you not be using Ubuntu.)

Again, this will take a minute – especially on older hardware. Eventually, the GUI will load and you’ll have a functional live instance running. If you needed to use nomodeset, acpi=off, or anything similar, you’ll probably also need to use those things to get the live instance of Linux running.

The tool we’re going to use is known as ‘fsck‘, which is a tool in and of itself and a front end for other tools. fsck interacts with more specific tools for your specific filesystem, but that’s not important right now. 

If you’re curious, fsck stands for ‘file system consistency check‘ and the man page helpfully describes it as:

fsck – check and repair a Linux filesystem

Now that you have a functional live desktop, it’s time to repair your Linux filesystem. The first step is, as is often the case, opening up your terminal. You can use your keyboard to do this, just press CTRL + ALT + T and a terminal should pop right up.

At this point, you’ll want to identify the correct disk. To do that, you run:

You’ll want to identify the disk where you installed Linux. That’s the disk that has the corrupted filesystem that is preventing you from booting. It’s often something like ‘/dev/sda1’ or maybe even ‘/dev/nvme0n1p1’.

Once you have the disk identified, it’s time to repair your Linux filesystem. Enter this:

NOTE: Change the /dev/sda* to match the data from the fdisk command you ran earlier.

That ‘fsck’ command should find and fix any errors automatically. If you really know what you’re doing, you can run ‘fsck’ manually and maybe do a better job than the automatic method. Then again, if you know that much then I’d suspect you don’t actually need this article.

This shouldn’t take very long to run, unless there were a whole lot of errors. Next, all you need to do is reboot and you should find that you were able to successfully repair your Linux filesystem. To do that from the terminal, you can just type:

When prompted, remove the disk from the drive and press the ENTER button.

Closure:

There you have it, another way to run fsck and to repair your Linux filesystem when it is broken. This method works even when the recovery mode will have worked.

Thanks for reading! If you want to help, you can buy some cheap hosting, unblock ads, donate, sign up for the newsletter (below), write an article, leave a comment, register to help, or just vote for the article below and leave a comment!

When Did I Install Linux? (Expanded Edition!)

In the other site’s version of this article, I only had information for Ubuntu. This time, I’ll expand it to cover the major distros. It seems like a good a time as any to fix this. (I’d link to the original article, but that page will now direct here.)

I’m not sure why you’d want to know when you installed Linux. I suspect that reason mostly curiosity that people ask, “When did I install Linux?” The question pops up with some regularity.

It’s really not vital information, and as such, it’s not a generic command that you can run to retrieve the information. There isn’t a whole lot I can do with the answer, except maybe jar a few memories loose. “Oh, yeah… That’s when I installed, so I must have bought the computer around that time!”

Really, this isn’t all that important. Still, it’s a fairly often asked question. If you have found a real use for this information, please feel free to leave a comment and to let us know why you need this information.

Let’s get on with it, shall we!

When Did I Install Linux?

Like many exercises, this one starts with opening up your default terminal. You can use your keyboard, by just pressing CTRL + ALT + TOnce you have the terminal open, you can use the following commands to see when you installed Linux.

Ubuntu/Debian/Derivatives:

If that doesn’t work, you can also use:

NOTE: Change /sda1 to the disk where you installed Linux.

Fedora/RedHat/Derivatives:

Arch/Manjaro/Derivatives:

And, there you have it. You now know how to check to see when you installed Linux. If you use some obscure distro (or have other ways to get this information) please feel free to leave a comment.

This article was revamped due to a comment from Wiz at Linux.org. They mentioned that they’d used the previous article and that they wanted the information for other distros. So, that feedback does work – even if it may take months to happen. Seriously, leave feedback and I’ll do what I can.

Finally, and as always, thanks for reading. You may have not noticed, but the site is now running ads from Google. It’d be great if you whitelisted this domain, but it’s okay if you don’t. Don’t forget the newsletter, that you can donate, contribute an article, and that you can share this article with your friends. 

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.