Find Your Username In Linux

Today’s article is going to be fairly brief and easy, as it just covers how to find your username in Linux. For this exercise, we’ll be using a terminal and some basic commands. It shouldn’t be too stressful or difficult. In fact, it should be just the opposite.

When you open your terminal, you’re usually greeted with some information. In that information is typically your username. However, it’s possibly that this is no longer true. You could have it display anything you wanted, plus there’s a chance you’re logged in remotely and just can’t remember which terminal window is connected to which device.

So, there are some reasons why these commands exist. I mean, you should probably know your username. That’s not the kind of thing I forget, but I am getting older. Still, the commands exist and must exist for a reason.

My motto is that they wouldn’t have provided a path if they didn’t want you to get to the destination. (That’s not really my motto.) So, if there’s a command that’ll help you find your username in Linux, you might as well know it and know how to use it.

Find Your Username In Linux:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With that terminal open, let’s try echoing the $USER variable. It’s nice and easy, and it looks like this:

You can also use who and whoami as commands:

And:

There’s also w, which shows logged in users – so you may be able to deduce your username from that list. It just looks like a:

The ‘w’ command nice and handy, and has a bit more information about the user. It would look similar to this:

w command's output showing username
See? It’s pretty easy to see that there’s a user logged in – and more!

As you can see, there are a number of ways. I’m sure that I’m missing some. Feel free to chime in and add to the list. Basically, if you want to share it with the world, leave a comment. Otherwise, many readers know where to find me.

Closure:

And now you have another article. This one isn’t fancy, nor is it something you’re going to need all the time. However, it’s still a very basic and useful tool to add to your Linux toolbox. Things like these are the fundamentals. How to find your username in Linux is an absolute beginner move and a move that leads you forward to more knowledge.

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: Find Out Which Kernel Version You’re Using

The Linux kernel‘s progress is marked by versioning, and this article tells you how to find out which kernel version you’re using. There are all sorts of ways to do this, but this article is going to just cover a few of them.

You might want to know which kernel version you’re using for when you ask for support. It may be that your hardware is best (or only) supported after or before a certain kernel. It may be that you want to know which kernel you’re using because you want to upgrade or downgrade the kernel.

For example, I recently didn’t want to switch to the new kernel. I saw that there was a kernel update, learned which kernel version I was now using, and promptly decided to return to an older LTS kernel. Yes, different kernel versions will have different support lengths. I opted for a more stable and consistent kernel as none of my hardware required a newer kernel.

There are any number of reasons why you’d want to know which kernel version you’re using. And, as stated, there are any number of ways to get that information. This article only covers some of them.

Find Out Which Kernel Version You’re Using:

This article will only show you how to determine which kernel version you’re using with the terminal. Of course, this means you need an open terminal. You can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, you can try:

The information is also contained in the output of ‘hostnamectl’, so working with grep you’d have this command:

You can also use cat on/proc/version in a command that looks like:

If you have screenfetch or neofetch installed, the output contains the kernel version that you’re using. An output from those would look kinda like this:

neofetch in action
Neofetch in action, showing the kernel version number. See? It’s all over the place!

So, there are any number of ways to find which kernel version you’re using. There are surely other ways to find the kernel version, so feel free to leave a comment letting us know how you find your kernel version.

By the way, if you’re having problem with your current kernel, your distro probably has at least the previous kernel installed and you can use that as a fallback. Even if it automatically deletes old kernels, it usually leaves at least one older kernel as a way to recover should the proverbial poop hit the aerator.

Closure:

See? That wasn’t so painful! It’s another article that’s said and done. We’re getting closer to the halfway point, but I’m legitimately having fun getting my notes online. I admit, I pretty gleefully monitor the increasing (or sometimes consistent) traffic. It makes me happy to know my notes are helping.

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.

Get Hardware Info With ‘dmidecode’

Today’s article will explain how to use dmidecode to get information about your hardware. The command is a little different than most, as it actually checks your system’s BIOS and reports that information.

Yes, you read that correctly. This dmidecode command checks the BIOS and reports that information. There are times when the BIOS reports different hardware than other tools, so it’s a good idea to have some knowledge about your hardware to begin with.

Anyhow, I could sit here and try to explain dmidecode, or I could just use their description – which is better than I could do.

dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS ) table contents in a human-readable format. This table contains a description of the system’s hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware. While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable.

As you can see, it’s a pretty interesting tool. It’s almost certainly installed for you by default. If it isn’t and you’re using a major distribution, check your system’s repos and it’ll be in there. It’s a pretty neat tool and one that you can use regularly, even though there are other tools that tell you about your hardware.

Using dmidecode:

This article requires an open terminal. Open one with your keyboard by pressing CTRL + ALT + T and your default terminal should open.

Many distros have dmidecode installed by default. If not, you’ll need to install it with your systems software installer. It’s bound to be available for any major distro. Now…

There’s a whole lot to this dmidecode thing, so we’re going to rely on the man page quite a bit. You’re encouraged to crack open a second terminal in which to run man dmidecode. That’ll help!

The first way to run dmidecode is with the -s flag, where you’ll use a name. In your first terminal, type the following to get the BIOS vendor’s name:

That’s the first (and pretty handy) way to run this command. Some of these commands will even give you information that helps you not have to open the case. That one helps you find the BIOS vendor’s name without having to reboot and check the BIOS yourself.

There are quite a number of options (names) that follow the -s flag, such as baseboard-serial-number, processor-family, or even chassis-serial-number. There’s a ton of them – so switch to the terminal with the open man page and check the text next to the -s flag for more information.

The other way to run dmidecode is with the -t flag. In this usage, you’ll need to know the corresponding number to the information you want. That’s okay, you don’t need to memorize them, as I explain below. The basic command is:

The number should correspond to the information you want. In the terminal with the open man page, you can scroll down to see your options. You’ll see that #13 is about the BIOS language, so command would look like:

The output would look similar to this:

dmidecode showing bios language
There’s some cruft in the output, but it is indeed the BIOS language.

You can refer to the above-mentioned man page, memorize them, or use a cheat sheet (if you plan on running the command frequently). I assume the project keeps things updated, so checking the man page at their GitHub would be the most correct source.

Either way, you will see that you will need to know both ways of running dmidecode in order to make the most out of dmidecode. You’ll need to be both fluent with the keywords and with the DMI Types, should you want to make the most out of this application – but you don’t have to memorize the entire man page.

Closure:

There you have it, another article is in the books! This time, it’s about dmidecode – a valuable tool to add to your growing arsenal of tools. It’ll save some time if you end up needing it, so you might as well learn about it before you need 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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Find Your Uptime In Linux

This article will do a bit more than help you find your uptime. There are a number of other thing that’ll be covered, but they all have to do with your uptime.

So, what is uptime? Uptime is how long your system has been up and available. It’s a useful metric, especially if your system is public facing or providing some sort of service that people depend on. In fact, Wikipedia has a definition!

For example, it’s a metric that matters a great deal in web hosting

That link is a link to my small hosting offering, but scroll down to the bottom at said link and you’ll see a link to check the uptime. In fact, I’ll save you a click and you can just click here.

That link is one way of examining system uptime and availability over the internet over a period of time that’s expressed in a pretty manner. You too can find the uptime of at least the system that you’re using, but we won’t be covering pretty graphs or network availability.

In this article, you’ll find your uptime by using the terminal. We’ll cover a few different ways as well as examine the uptime command.

By the way, you can just type man uptime and see how to use the command. It’s not exactly complicated. Anyhow, uptime defines itself as:

uptime – Tell how long the system has been running.

And that’s a pretty accurate statement. So, let’s examine that first!

Find Your Uptime:

For this exercise, you’ll need an open terminal. To open the terminal, just press CTRL + ALT + T and your default terminal should open.

Once the terminal is open, let’s start with the basics:

That’ll give you a basic output, along with your load averages. If you want a more easily readable output, you can just use the -p flag.

If you want to know when it’s counting from, when your system became available, you can do that. To do so, it’s just the -s flag.

That’s pretty much everything that the uptime command can do. That’s not the only way to find your uptime, however. For example, you can open top or htop and see your uptime. If you use htop, it looks like this:

htop showing the uptime
See? It’s right there! It’s in ‘top’ as well. Now you know!

You can also use just a ‘w’ easily enough. It too will find uptime it looks like this:

You can also use ‘screenfetch‘ or ‘neofetch‘ to get your uptime. If you have one or both installed, the commands would look like one of the below:

Both of those will find your uptime and display them.

As you can see, there are many ways to find your uptime. In fact, I’m sure I missed some ways that you might use. If you use a different method, or know of another method, please feel free to leave a comment below!

Closure:

Well, this is it. It’s another article. I must be approaching the halfway point. The goal is to keep this project going for a year and to reassess at that time. If it’s something that’s popular, beneficial, and I’m not burnt out, I’ll keep going with it. Maybe by then someone else will want to take over or help write some stuff? Who knows? We’ll find out at the end of the year!

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: Display System Information With screenFetch

I have previously written an article about screenFetch vs. Neofetch, and it’s one of my most popular articles, but this one will tell you how to display system information with screenFetch. Why screenFetch? Why not? It’s perfectly usable and this gives me the chance to be more thorough than the previous article.

I suspect I’ll do a similar article about Neofetch, but today is not that day. No, today is about screenFetch (which is horribly stylized with just a capital in the middle) and it’s a fine tool to display system information. In fact, it describes itself as:

screenFetch – The Bash Screenshot Information Tool

screenFetch is one of the tools that displays system information in the terminal. It does so with the goal of being displayed in a screenshot so that you can brag to your friends. It really doesn’t have a whole lot of value beyond that, but that’s fine. It’s informative and handy, and suitable for purpose.

So, without further ado, let’s get into this!

Install screenFetch:

Fortunately, screenFetch can be easily installed and it’s widely available. You can install it from your default repositories easily enough. There’s some odds that it’s already installed by default and, if not, we should be able to get you squared away. 

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open. With that terminal open, let’s get screenFetch installed with one of the following commands:

Fedora:

OpenSUSE:

Debian:

Manjaro:

If none of those work, you can just try installing it as you’d install any other app from the terminal. Chances are really good that it’s in your default repos, so  you can graphically find it through your software manager. In fact, it is often installed along with the OS. Now that it’s installed, let’s move on.

Display System Information With screenFetch:

It’s pretty easy to get the basic output. You really only need to enter:

As I mentioned above, screenFetch is meant for screenshots. Sou can get screenFetch to automatically take a screenshot and drop it into your ~/ directory. Just use this command:

If you plan on sharing this information on forums and to show off to your friends, screenFetch has another neat feature. You can not only take a screenshot,  you can theoretically upload it automatically. To do so, you’d use this command:

However, that currently appears to not work. It’ll seemingly upload the screenshot, but it doesn’t give you a direct link to the screenshot. That’s not helpful – but I’m pretty sure this used to work. As screenFetch hasn’t been upgraded in a while, it may be that the image hosts have changed their API. Dunno, ‘snot my job to know. I suspect it’ll someday work again, should the devs continue with the project.

Anyhow, that’s how you use it. You can run man screenfetch to get more information, but the general usage explained here is about all you’ll really use. The point of this article was more to share how install screenFetch than how to display system information with screenFetch.

Closure:

And there you have it, another article. The goal of this one is more to tell you how to install screenFetch in various distros. Once you have it installed, it’s pretty easy to use screenFetch to display system information. If nothing else, it’s yet another article in a growing list of articles.

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.

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