Find The Boot Processes That Slow You Down

In today’s article, we’re going to show you how to find the boot processes that slow you down. What you do with this information is up to you. You can opt to tweak and try to speed up the boot process, or you can just learn to live with it. It shouldn’t be too long – or too hard.

Note: This article assumes you’re using systemd. If you’re not, get with the program!

With modern computers, even those a decade old, I don’t really understand the fascination with speeding up your boot process. This is especially true with Linux. After all, how often are you booting? People spend 3 hours improving the boot time by 3 seconds!

using uptime to show how long the system has been running
As you can see, I do not reboot all that often, pretty much only as needed.

Even if you reboot every day, unless your boot time is so slow that it’s indicative of a problem, you can always just press the power button as you walk by the computer to get your morning coffee.

This article is aimed towards those who have a slow boot problem. It’s aimed at you people who have slow boot times, boot processes that slow you down without good reason. People interested in optimizing their boot time can also benefit from this article, but that’s not the point.

Also, this article isn’t going to show you what to do next. This article will just be showing you how to find the boot processes that slow you down. The steps you take from there will vary based on your problems or your objectives.

Find The Boot Processes That Slow You Down:

Like oh so often, this is a trip down Terminal Lane. We do a lot in the terminal on Linux-Tips! It’s great to get new users to get comfortable with using the 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.

With your terminal now open, we can take a look at the boot process. To do so, let’s start with a basic command:

Picking one of the slower devices in my stable, you end up with an output similar to this picture:

output from systemd-analyze
That’s rather middle of the road, I would assume. You can get much faster and slower.

With that information, you can see how long it takes to reach ‘userspace’. For most folks, that’s going to be the number you’re interested in – as it’s when you can graphically interact with the system, usually to login to the system.

I should also mention that that’s not the total boot time. The computer has its own boot process. This time only includes what happens after POST, as the Linux operating system takes over. It doesn’t include how long you saw the original computer’s OEM logo/boot screens or anything like that. Your real-world boot time will be slightly longer.

So, let’s have some more details and see how that startup is actually working. Let’s see how long it takes for each step of the boot process. To do that, you’d want to look at the following command:

Yup, it’s a bit of clever naming. It’s systemd letting you know what process(es) to blame for a slow boot time. Pretty handy, huh?

If you want, you can even make a nifty picture of the boot process – a picture that includes showing  you the dependencies needed to complete the boot process. 

That’ll output an image that’s quite large, to large to bother including, but it’s easy enough to understand. If you’re having serious issues booting, that image might be something you can share with a forum when you’re asking for assistance.

What steps you take next will depend on your individual situation. If you’re looking to speed up your boot process, you can mask services that you don’t need. If you’re having problematic services and/or dependencies, your situation will be different and require different fixes.

Closure:

And there you have it! You have another article. This article tells you how to find boot processes that slow you down, so it’s an article that could be helpful to all sorts of people. Once you have this information, you can start looking to make changes. It’s a handy way to get boot process information with systemd.

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: Show systemd Services

Today we’re going to have a quick and easy article, one where I show you how to show systemd services. We’ll explore a way to show all services and those services that are currently running. It’ll be nice and easy. 

At this point, systemd isn’t really all that controversial. It was for a while and there are still some people who work kinda hard to not use systemd. That’s their right and I support their choices, but I dare say that most of us now use systemd and that aiming articles at the majority is a good idea. So, I have no problem covering systemd stuff – and I have even less trouble treating it as though systemd is the default.

It’s kinda hard to pin down a definition for systemd. It’s far more than an init system, which it was replacing fairly early on. It has grown to encompass quite a bit more than that. So, let’s just look at how Wikipedia describes systemd.

systemd is a software suite that provides an array of system components for Linux[6] operating systems. Its main aim is to unify service configuration and behavior across Linux distributions;[7] Its primary component is a “system and service manager”—an init system used to bootstrap user space and manage user processes. It also provides replacements for various daemons and utilities, including device management, login management, network connection management, and event logging.

So, you can see it’s pretty expansive. For this article, we’ll be looking at the service manager aspect and how to show your systemd services. Let’s just jump into the article, so that we can keep it relatively brief.

Show systemd Services:

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. (I say this so very, very often…)

So, I said I wanted to keep this article brief – and there’s really no reason to make it longer, so this is how you show all the myriad systemd services:

Or you can try:

Either one or both of those commands should show you all the systemd services, regardless of what state they’re in. Though it should show you the state of the services listed.

A more useful command for most of us would be for us to show the various systemd services that are currently active. Of course you can do that! It’s Linux! You can do everything! It’s not even hard! Just try this command:

You can also try this command:

If you pay attention to the syntax, you can also opt to show those systemd services that are inactive. It’s probably pretty obvious, but try this:

Or you can try this one (’cause you have choices):

So, as you see, you can show the systemd services in total, show the active systemd services, or choose to show the systemd services that are inactive. It’s not a complicated task and there’s no reason to make it seem complicated. As the tag line says, we’re slowly but surely bringing you up to speed!

Closure:

And there you have it. You have a new article! This time you’ve learned how to show all of your assorted services – and to show the services in all their running states. Some folks like to make this sort of thing look complicated, but it’s really very easy. So, enjoy the new article and know that I appreciate your readership.

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: Scan A Remote Host For Open Ports

In today’s article, we’re going to learn another way to scan a remote host for open ports. It’s actually going to be an easy article to follow, suitable even for beginners. Read on, I promise it’s not all that complicated! We can make this pretty simple.

There are a couple of reasons why you’d want to scan for open ports. You may want to know what ports you have open, or you may be interested in penetrating a remote host and want to know what ports are open (and things like what services are running on them).

This may seem  a little familiar. We recently used the ‘nc’ command to check if a specific port is open. You can (and should) read that article (it goes into describing ports, so it’s worth reading as I don’t want to duplicate the work) here:

How To: Check If A Specific Port Is Open

Again, if you’re not all that familiar with ports, you should read that article. It explains them in more detail.

The tool we’re going to use is ‘nmap‘, a familiar tool that’s used by security professionals, but can be used for our purposes just fine. It’s not all that daunting, which is why I feel even a beginner can learn to scan a remote host for open ports.

Installing nmap:

Alas, nmap is seldom installed by default. As such, you’ll need to install it. We’ll do that in the terminal. If you need to open a terminal, just press CTRL + ALT + T and your default terminal should open.

So, let’s get nmap installed:

Fedora/Derivatives:
Debian/Ubuntu:
RHEL/CentOS:

I know those should work, but nmap will certainly be in most default repositories. You should be able to install it with your package manager. Once you have nmap installed, you can check the man page to see how nmap describes itself:

There, you’ll see:

nmap – Network exploration tool and security / port scanner

Which, as you can guess, is a pretty good description. You’ll also notice that there are a whole lot of options. It’s a pretty complicated command. Don’t worry, we’ll make it easy for our goal, which is too…

Scan A Remote Host For Open Ports:

You should have an open terminal from the previous section. You’ll need that. While there are graphical tools for scanning for open ports, nmap is not one of them. You use nmap in the terminal, like so many of the great Linux applications.

So, then let’s start with the basics. If you want to scan a remote host for open ports, your best starting point will be:

For example, you could use Linux-Tips.us as a test:

Or you can use a computer on the same network via the hostname or IP address. That’d look like:

However, that command won’t actually scan all the possible ports. It only scans the 1000 most common ports, which is usually what you’re after. You can scan the entire range of ports if you want. That’d look like:

If you want, you can actually scan for a specific port to see if that port is open on the remote host. That’s a bit more complicated, but not much. Try a command that looks like this:

To try to make that more clear, see the following example to check to see if the default SSH port is open:

I’ve even made you an example image of the above commands:

a number of nmap commands being used to scan a remote host for open ports
As you can see, it’s pretty easy to use nmap to scan a remote host for open ports.

See? While nmap may seem daunting when you first check the man page, it’s pretty easy to use nmap to scan a remote host for open ports. It’s even easy enough for a newbie to use!

Closure:

Well, that’s another article. I have yet to run out of notes and I have yet to run out of ideas for articles. So, there are likely to be even more articles written. Eventually, I’m sure to run out – or need a break. But, for now, you have an article that tells you how to scan a remote host for open ports. It’s even easy enough for a beginner.

The nmap application is one of the first tools you’ll learn when you decide to learn about network security. If you want to probe a site for security holes, it’s important to know which doors are open and available for you to explore. Well, that’s where tools like nmap come into play and this article will get you started.

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.

Find And Remove Duplicate Files With rdfind

In today’s article, we’re going to find and remove duplicate files with rdfind. We’ll try to make this as safe as possible. I’d suggest newer  users not actually worry about duplicate files. Allocate enough space to your OS and don’t worry about it. Disk space is cheap these days.

Warning: Blindly removing duplicate files can be a risky operation. It can break things. You have been warned. Exercise caution!

If you’re interested in removing duplicate files, then the rdfind application is one solution you can try. There are others, but we’ll be using rdfind. We may cover other choices in the future.

You don’t have to run rdfind with it automatically deleting the duplicate files and that’s what I’m going to suggest you do – at least at first. It’s good to see what’ll be deleted before it is actually deleted.

If you check the rdfind man page, you’ll see it’s described as:

rdfind – finds duplicate files

It does what it says on the tin. It finds duplicate files. You can run the command in a manner that automatically removes the found duplicates, but that’s not something to take lightly.

Again, and I can’t stress this enough, some duplicates are there for a reason – they belong there. So, don’t run this on the root directory and expect a good outcome. Running this on the root directory and automatically removing duplicates is going to break stuff. Feel free to do so, ’cause it’s your computer. Just don’t blame me when it breaks.

There… I feel you’re safely and properly informed! Let’s get this article started…

Install rdfind:

We’ll just use the terminal to install rdfind. To open your default terminal emulator, press CTRL + ALT + T and your default terminal should open. You might as well leave it open, as rdfind also runs in the terminal and you’ll need an open terminal in the next step.

Debian/Ubuntu:
Arch/Derivatives:
RHEL/CentOS:
Fedora/Derivatives:

Now that you have installed rdfind, you should probably consult the man page. That’s an easy command:

With that knowledge fresh in your memory and rdfind installed, we can just jump into the article!

Find And Remove Duplicate Files With rdfind:

Your terminal should still be open from the previous step. If not, go ahead and open it now. You’ll need a terminal open to find and remove duplicate files with rdfind. It is not a graphical application.

So, I suppose you can start with this command:

That may look dangerous, but it’s not. If you run that command, it simply finds the duplicate files and then creates a text file for you. You then review the text file and manually remove the duplicate files. This is probably for the best. It’s also the same thing if you do a dry run, like so:

You can actually delete the files and replace the first one found with hard links. While not recommended by me, it’s at least safer.

Finally, you can just go right ahead and just find and remove duplicate files! This is safer if you have both a recent backup and you’ve gone ahead and run one of the first two commands. Then, if you have run one of those two rdfind commands, you’ll know what’s going to be deleted.

Just don’t run rdfind on your root directory, and probably don’t run it directly on your home directory, and you should be more or less okay. Feel free to run it on your Downloads folder, on your Documents folder, or even your Pictures folder.

Running rdfind that way, on those types of directories, will be fine and at least should not break things. Rdfind pretty good at finding just duplicates, or I’d not recommend it. Be sure to backup first and make sure you give it a dry run before you start automatically removing stuff! Seriously, do not run this on your root directory.

Closure:

And there you have it… You have yet another article! This time, we’ve learned how to find and remove duplicate files with rdfind. You were given a clear warning, but you’re gonna do what you’re gonna do. Man, I really need to write that article about backing up properly!

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.

Find Multiple Filenames By Extension – With Locate

In today’s article, we’re going to explore another way to find multiple filenames by extension – with locate. It’s a handy skill to have and will see you installing ‘mlocate’ to get access to the ‘locate’ command. It shouldn’t be a difficult or even very long article.

If this seems really familiar, then you’re paying attention. After all, it was just a couple of days ago that you saw this article:

How To: Find Multiple Filenames By Extension

So, why are we covering the same topic? Well, WordPress, for legitimate security concerns, likes to eat the slash. (It’s a slash and a backslash. There’s no ‘forward slash’ if you want to be *technically* correct.)

Slashes are understood programmatically, by many programs – including PHP. So, in theory it’d be possible to at least probe for exploits with an unescaped slash. The solution is sort of to escape the slash by including two of them, but then WordPress eats that escaping slash every time you save a draft and add to it!

This is extremely frustrating as an author. It seriously sucks. It’s something I’ll need to keep in mind for future articles, always wary of the dastardly slash! At least now I know…

Well, that hassle of escaping the slash also reminded me that we can accomplish the same thing without any slashes, just by using the ‘locate’ command. With the previous article still fresh in my memory, I figured I might as well write the same article – but with a different tool. Why not?!?

Install mlocate:

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 ‘locate’ command is actually a part of the mlocate package. It’s not always installed by default, but it should be in every default repository out there. It should be easy enough for you to install. 

For the record, the ‘locate’ command describes itself like:

locate – find files by name

Well, that description looks promising – and is exactly what we’re hoping to accomplish! So then, go ahead and install it. You can install it just like you’d install any other software. In the terminal, it’d look something like:

Install mlocate In RHEL/CentOS:
Install mlocate In Debian/Ubuntu:

That’ll work for most distros, assuming you’re using those package managers. If you’re using a different distro, just go ahead and try the same command but adjusted for your package management software. You should be able to find and install it easily.

NOTE: You’re not done yet. The locate command works off of a database. It’s really quick to generate it and it will use a cron job to keep itself updated after that. So, to get the database started, you’ll want to use this command:

With that done, you’re good to go to the next step…

Find Multiple Filenames By Extension With Locate:

Don’t close your terminal from the previous step! Like oh so many articles, this one also requires an open terminal. So, with your terminal still open, you can start to find filenames by extension with locate. For example:

That will find filenames by extension (with ‘locate’) in the current directory. If you want to specify more filenames, it’s really simple:

You can find just one file by extension:

Or you can find a few files by extension:

The sky’s the proverbial limit and the syntax is so much easier. It’s my understanding that the ‘locate’ command is faster because it relies on a database. I ran a couple of tests, using the article about how to time a command and the results weren’t really conclusive – but I only tested with very simple operations. So, your mileage may vary. Feel free to test it and let me know your results!

Closure:

Well, there’s another article. This time, you’ve learned how to find multiple filenames by extension with ‘locate’, and seen that ‘locate’ is a handy command with easier syntax. So, if you’re interested in the ‘locate’ command, be sure to check the man page (man locate). There are many folks who seem to prefer the ‘locate’ command in general, so it seemed like a good article to include.

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.