Let’s Take A Look At Logged In Users

Today is a good day to learn how to take a look at logged in users. The vast majority of my readers are desktop users, so you can mostly skip this article. On the other hand, when you take a look at logged in users, you might find users you didn’t know were logged in and discover a problem like unknown users.

Yeah, most of you – including me at the moment (which makes it difficult to do things like take useful screenshots) are using Linux (mostly) as a single user. You have a user and you login to that user account when you start your system up.

While you do have other system-configured users, you don’t generally login as those users. As such, you probably spend very little time thinking about the users you have. Those system users aren’t generally logged in but are there for permissions purposes, so they’re out of mind for most of us.

Well, for the rest of you, you can use this article to learn how look logged in users – even getting a glimpse at what they’re doing. I mentioned some difficulty in taking screenshots, so I’ll provide you with just one. Cherish it, as it’s the only one you’re getting!

Here it is:

looking at other users
See? I’ll reference some of this below, in the article itself. I might as well…

Have A Look At Logged In Users:

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.

As you can see from the image above you can see all the logged in users with the first command. The following command will list them:

You’ll see the same thing, with a bit more information, when you use the following command:

Now, in the image above, you can see where I used it once and then ran it again. What you don’t see is that, in between those two commands, I opened up another TTY and logged in again as ‘kgiii’. If you want to replicate that, just press CTRL + ALT, then F3 to F6, and login at the prompt with any user(s) you happen to have.

Finally, you can get a look at what they’re doing – like one has a desktop session open and two of those login instances just have bash sessions open in TTY sessions. To do that,  you just use:

That should be easy enough for you to remember! By the way, if you did login as an additional TTY instance, run ‘users‘ again and you’ll see the output for that command has changed accordingly. The command’s output will may also give you a good idea about how long the system has been up and what the system resources are like.

Closure:

There you have it. You have learned how to have a look at logged in users so that you can have an idea of what’s going on with your system. If you spot a user you don’t recognize, that might be indicative of a problem. If you spot a user you don’t recognize, you’ll need to do some more investigating. By the way, if you have ‘finger’ installed you can always run ‘finger <username>‘.

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: Clear The apt Cache

In today’s article, we’re going to learn how to clear the apt cache. This is only useful if your distro uses the apt package manager. If your distro doesn’t use apt, this article is of no use to you. This isn’t a complicated article, but it’s one that should probably be included on this site.

If you don’t know if your distro uses apt, you really need to pay more attention! However, run ‘which apt‘ in the terminal and it’ll let  you know if apt is present.

If you’re using Debian, Ubuntu, an official Ubuntu flavor, or any derivative thereof (such as Mint), you’re using ‘apt’ as your package manager. Of course, if you’re new and not all that familiar with apt, you’re able to use this site’s search feature and find out some more information. Feel free to do so, as I’ve written a few articles on various apt features.

If you want, you can read this article from FOSSLinux for a great rundown on APT vs aptitude, that’ll also answer some other questions along the way. It’s a great article to understand apt, not just the differences between apt and aptitude.

When you install applications and updates with apt, the .deb files are cached on your device. In time, this can build up and use more space than you really want to have spent on such a feature. So, let’s learn how to clean it.

Clear The apt Cache:

Obviously, this article requires an open terminal. 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.

Now, you can see what is going to be deleted – which directories that is – by using the dry-run flag.

Those are the directories which will be cleaned. The first command you might already know is this one, which seems to be one of the favorites for new users:

However, that only removes cached packages if there’s a newer version in the repositories. I don’t really see much use for that, but it’s there, a feature, and often a command that newbies are told to run.

Instead, you can clear out all those directories of no-longer-needed .deb files. Just run the first command without actually doing a dry run. It is done like so:

That’s really all there is to it. I mostly wanted to ensure folks knew how to clear the cache – and that the difference between the commands was mentioned somewhere on the site. I don’t expect the site to be some giant repository that’s ‘complete’, but I do need to cover the basics now and again.

Closure:

Well, today you’ve learned to clear the apt cache. Again, this isn’t going to do you any good if you’re using RHEL, Fedora, or even Arch! But, if you use a distro that uses apt, you might as well know this information. And, well, now you do…

Also, I linked to another site with similar content! I don’t do that often! Their write-up was just too good to pass up, so I don’t mind sending them the traffic. It saved me like an hour’s worth of writing – while trying to fit it into a block of no more than 300 words. So, I’m very, very much okay with linking to content like that.

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.

Let’s Upgrade Fedora From The Terminal

Today’s a good day for a short article, like one on how to upgrade Fedora from the terminal. It’s a pretty easy task, yet one I have in my notes. I see no reason to not turn it into a nice, short article. After all, you might not know how to upgrade Fedora from the terminal!

Obviously, you’re going to need Fedora installed for this. Though, technically, I’m sure you could do this if you were trying the live instance of Fedora. I mean, you could…

Anyhow, all operating systems should get updates. If you’re not getting updates, something is wrong. The most obvious ‘wrong’ in this is that you’re using an operating system that’s no longer supported. By doing so,  and doing so online, you are not just a risk to yourself – but you’re a risk to other users.

For example, you could be compromised and become a part of a botnet. That’d be bad. So, stay updated – not just for yourself but to be a good member of the community. Use a distro that’s still supported.

Lest you think this is a weird article, I’ve actually also written:

How To: Update Ubuntu From The Terminal

See? ‘Snot the first time we’ve had this sort of article. 

Well, let’s get into it. Let’s learn how to …

Upgrade Fedora From The Terminal:

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 your terminal open,  you can start with a very simple command:

That’s “it”, I guess… Well, no… That’s all you need to do to upgrade your system. If your system requires a reboot, you do that with:

Now, here’s a little trick…

Let’s say your upgrade screwed something up. You upgraded to a new version of Thunderbird and you want to roll back to a previous version. You can do that without much effort. 

Obviously, change the name of the application to the application you’re having problems with. Well, each upgrade will have a number assigned to it and it’ll show that number when you run the above command. You use that number in this command:

That will undo the most recent upgrade to that application, restoring a usable application for you. You can then try it again when the application is next upgraded.

See? It’s a neat little trick with ‘dnf’. Feel free to check the man page, with man dnf, to see what other little gems you can find.

Closure:

See? I told you that it’d be a nice and easy article. This one isn’t difficult – but does have a neat feature not everyone knows about, that is how to rollback upgrades with DNF when you have chosen to upgrade Fedora from the terminal.

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.

Make wget Use IPv4 or IPv6

Today’s article is a fun one, an article where you learn how to make wget use IPv4 or IPv6. Not only is this useful, it’s easy! In fact, it’s easy enough for most anyone to figure out. Plus, this will be a fairly short article – I think. I mean, I haven’t written it yet, but it seems like a short one.

I’ve done a couple wget articles, with the most recent showing you how to make wget ignore certificate errors. In fact, in that article I showed you how to enable that permanently. I’ll have to add that to this article. That’ll come in handy for like 0.01% of you.

If you don’t know, wget is a tool for downloading content from servers. These days, we use it to grab stuff from web servers without having to go through a browser – more often than not. Sometimes we use it to scrape entire sites without actually visiting them in a browser! (Sometimes, doing that makes you a dick.) It’s a handy tool for that sort of stuff.

Once in a while, while using wget, you’ll come across a finicky download that will throw an error about wanting IPv6 (or IPv4 if you’re using IPv6). That’s when this article is going to come in handy. Sometimes, a server isn’t configured for, or will refuse connections from, one or the other. That’s when you’ll see errors and that’s what we’ll resolve in this article.

Hmm… Do I need to explain wget more? Nah, y’all know what it is. IPv4 vs IPv6? Well, how about you check out this link to learn the difference and why it matters. That’s a good link. Alright, moving on…

Make wget use IPv4 or IPv6:

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. The wget command will throw an error, letting you know if you must use one or the other.

If you need to force IPv4, it’s nice and easy:

If you need to force IPv6, it’s also nice and easy:

If you find yourself doing this often, one way or the other, you can actually tell wget to do this on a permanent basis. Like in the previous wget article you can edit your .wgetrc file (create it if it doesn’t exist) to include either --prefer-family=IPv4 or --prefer-family=IPv6 and it’ll try one before trying the other if it’s available.

Closure:

See? Nice, neat, and simple. You’ve learned how to make wget use IPv4 or IPv6 – should you find yourself needing to do so. It’s a handy trick to have up your sleeve, ’cause you will eventually find a server that requires one or the other. Given enough use, it’s gonna happen.

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.

Let’s Install And Use ‘locate’

Today, we’re going to learn to install and use locate and we’ll even cover some basic usage. If you’re unfamiliar with locate, it does exactly what you’d expect – it helps you locate files on your computer. Read on for a basic understanding.

The locate command is a terminal-based command, a text way to find files on your computer. It can be a pretty useful command – with some advanced usage – but we’ll just cover some basics.

The locate command is actually installed by installing ‘mlocate‘. So, let’s just get that out of the way. Depending on the distro you use, it’ll likely be in your default repositories and you can install it much like you’d install any other software. For example, in a distro that uses apt you’d install it with:

You may have it installed by default. You can check that with:

If that spits out a version and some version information, you’ve already got it installed and there’s no need to install it.

Anyhow, with that accomplished, let’s learn a bit about how to …

Use Locate:

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.

Of course, you’d have had to open the terminal in the preamble, but I  might as well tell you again. With the terminal open, you can check the man page for locate. You’ll see it does exactly what you’d expect it to do:

locate – find files by name

To use the locate command, it’s quite simple. It’s ‘locate <flags> <file_name>‘ and really quite simple. It does what you tell it to do, nice and easy. 

For example, it may return a lot of results:

Or it can be quite targeted:

However, it needs a database to work from. If you’ve just installed the mlocate package, you’ll need to update the database. Hmm… I probably could have mentioned this sooner. Oh well… You’ll find it if you need it. It pays to read all the words, folks!

To update said database, it’s this command:

Now, there are a couple of useful flags. We’ll cover a few. You can just return a number of how many files match the description with the -c flag:

You can limit the number of responses with ‘-n <number>‘ easily enough:

The locate command defaults to being case-sensitive, but you can change that behavior with the -i flag:

Finally, you can check the database statistics with this command:

While there are other options for the locate command, including using it with other commands, those are the options I find myself using more often than not. I suspect those will be the most often used options when you too make use of the locate command. Be sure to check ‘man locate‘ for more information.

Closure:

See? It’s a quick and easy article about how to use locate to find files on your Linux computer. It’s not terribly difficult and it’s a handy command to have learned. As mentioned, the man page has even more options for you to use the locate command. Feel free to check ’em out.

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.

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.