How To: Change Your Password In The Terminal

It’s considered good form to change your password once in a while. This may not be something important for you, but others may appreciate it. It may be corporate policy or regulations that make you need to change your password, or you could just be more security minded than many others. No matter what, this article tells you how.

The tool we’re using in today’s exercise is called ‘passwd‘, which is a tool to help make and manage passwords. It’s a bit complicated, but it uses something called hashing and stores a hash instead of a plain-text password.

When you login, your password is checked against the hash that was created when the password was created. This prevents people from easily reading your stored password, stored of course because there must be something to check against.

If one remembers way back to the start of this project, my goal is to put my notes online. This article is in my notes, which is why this is such a simple article. Indeed, this article should be pretty straightforward and easy to understand. I’d definitely call it a beginner-friendly article.

Change Your Password:

Like most always, you need to open your terminal. You can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have your terminal open, the command you’re looking for is:

If you already have a password, you’ll need to type your current password and then you’ll type the new password twice. When you logout or next need to use your password, your new password will be required. You don’t need ‘sudo’ for this, as the password you’re changing belongs to you.

Seeing as this is short, I’ll toss in another use of passwd. If you want to change the password for a different user, you just use this command:

Change the obvious to the obvious, specifically the username. This command does require ‘sudo’, because you’re changing a password that doesn’t belong to the current user.

There’s more that can be done with passwd, but those things are beyond the scope of this article. I’d expect to see some more passwd uses covered in the future, but you can get a head start by typing man passwd into your terminal and learning about the other options.

Closure:

That’s it, really. I told you that this one would be short and easy! Sure enough, it’s pretty easy. Many of my notes are regarding people who are new to Linux, but it’s still nice to get more of them online. I dare say we’re coming along nicely.

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: Check CPU Temps With lm_sensors

There are a variety of ways to check your CPU temps, and this one will be covering this with lm_sensors. It’s a handy application and it’s often installed by default. Moreover, it’ll be available for pretty much every distro out there.

This time around, we’ll be using the above-mentioned lm-sensors. Wikipedia describes lm_sensors as thus:

lm_sensors (Linux-monitoring sensors) is a free open-source software-tool for Linux that provides tools and drivers for monitoring temperatures, voltage, humidity, and fans. It can also detect chassis intrusions.

It then says that a citation is needed. Thank you, Wikipedia. That’s helpful.

With so little to go on, we can check the man page. Alas, man lm_sensors has no entry. You’ll actually need to use the less obvious man sensors. That description isn’t much better, but it beats a blank.

sensors is used to show the current readings of all sensor chips. sensors -s is used to set all limits as specified in the configuration file. sensors –bus-list is used to generate bus statements suitable for the configuration file.

This will, of course, also tell you more about using lm_sensors, though there really aren’t a whole lot of options. It outputs what it outputs and you’ll like it. You’ll potentially get more information than just the CPU temps, but this article is about how to check CPU temps.

Check CPU Temps:

This rest of this article should be short and straightforward. Like normal, open up your default terminal emulator by pressing CTRL + ALT + T. Once the terminal is open, you can install lm_sensors easily enough. Try one of the following (note the varied names):

Debian/Ubuntu/etc:

Suse/OpenSUSE:

Fedora/RHEL/Rocky:

Arch/Manjaro/etc:

So far so good, yes? Well, now we need sensors to find our hardware and that’s another command in the terminal. Specifically, it’s this:

That’s going to run and it’s interactive. You will have to type “YES” over and over again. You’ll eventually need to hit the ENTER button. Fortunately, once you’re done, it’s all over and you never have to do it again – unless you add/change hardware that has sensors.

With lm_sensors loaded properly, let’s check CPU temps! It’s a really simple command – and it’s just:

If you are an American that is easily frightened by the metric system, you can just add the -f switch for Fahrenheit, like so:

Your output should look something like this:

lm_sensors in action
That’s a pretty standard output. Note the included CPU temps (listed by core, starting at core 0).

It should be noted that there’s more to the output than the CPU temps. This is not always the case. Your hardware may not have sensors that report back the operating conditions – but your CPU will almost always report that data so that the OS can do things like throttle-down for energy saving purposes. Be sure to run man sensors to see the rest of the options.

Closure:

Congratulations! You can now easily tell how hot (or cold) your CPU is running. You should also look up your CPU’s temperature thresholds. This way you’ll be able to tell if your CPU is running hotter than it should be running. Doing this can save your hardware or give it greater longevity.

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.

Guest Article: What Are SSH Keys?

The following article is a guest-written article from Andy Brooks (aka captain-sensible) about SSH keys. So, let’s put our hands together for a guest author and appreciate that I got a break from writing articles! Thanks, Andy!

There are a few articles about SSH already:

Install SSH to Remotely Control Your Linux Computers
Enable x11 Forwarding With SSH (Remotely Use GUI Applications)
How To: Change The Port SSH Uses

What Are SSH Keys?

Recently, I created an account for the AUR (Arch user repository) with a view to taking over an maintaining an Aurphan AUR package. On the registration form, which included the usual user name etc, was a text box asking for my SSH public key? You might wonder what is that, why do the AUR want it, and how are they going to use it?

Well the AUR would hold my public key and that would be associated with my user account. What I would want to do with the AUR for a package would be update the PKGBUILD file and get those changes published on AUR repository. So basically that would require getting access to the server of the AUR by logging in and then pushing up my changes to it.

So how are SSH keys involved in that process ? Well on my PC in my home folder there is a directory called .ssh inside are two text files called id_rsa id_rsa.pub. The information held inside the id_rsa.pub, the AUR has a copy of.

If and when I access AUR to make changes, to any package on the repo, there is an exchange of information over my terminal that I am using as a communication channel via ssh. The server sends a challenge, which is to see if my private key matches up with the public key which the AUR server is holding a copy of.

A couple of points are the process involves encryption and the only key that should be “given out” to anybody is the public key. The private key should be, well kept private and out of peoples hands. Putting it simply, ssh-keys are a way of securely giving users access to remote servers. Secure Shell was created in 1995 by Tatu Ylönen a Finnish national following a password-sniffing attack at his university.

Now for registration for accounts such as with the AUR, there are really only two things you need to do.

1) create as a “once off” a pair of private & public keyserver-options.
2) Give the details of the public key to the AUR server.

Creating SSH Keys:

Lets start with item 1):

ssh-keygen is a utility of openSSH so you need to install that, then from a terminal simply issue the command (as a normal user not sudo): ssh-keygen

To keep things simple, you can accept the defaults by hitting return button.

At the end you should see something like in the adjacent image.

ssh keygen
Yours should look pretty similar to this!

Note: At this point, you can generate a password/passphrase. Doing so can increase the level of security, but the choice is yours to make.

Now lets look at 2):

From your terminal, check you are in your home folder, or cd to it eg ($ cd ~ )
Then change directory into the .ssh directory with cd .ssh
Then get contents via cat
cat : [andrew@darkstar:~/.ssh]$ cat id_rsa.pub

You should get something like : ssh-rsa AAAAB3NzaC1yc2EAAAAD… There will be something like 569 chars in all. 

From the terminal you can just copy starting from the ssh-rsa ….. to the end; then you can just paste that into a text box asking for your public key.

A quick warning the two keys generated are a matched pair. Once you submit your public key, don’t just repeat the default way of generating keys otherwise the keys will be overwritten and then you will be rejected from getting access to where you last put your public keys.

Also to see the .ssh directory in your home folder, you may need to click view hidden files and dirs.

Closure:

And there you have it, a guest-authored article about SSH keys! I’m very grateful for the help. If you’re interested in writing an article, you can do that. The easiest way for you is to use the Contribute Your Article link at the top of any page. The easiest way for me is if you just register and ask to be made an author. Either is awesome and even if you’re an author I will still need to edit and schedule posts.

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.