Disable Bluetooth From Automatically Starting At Boot

In today’s article, we’re going to learn how to disable Bluetooth from automatically starting at boot. It’s a handy thing to know, if you’re like me and have no real use for the service.

I suppose it’d even speed your system’s boot time a trivial amount and reduce the number of running services. So, it’ll make your system a trivial amount more efficient. I just don’t care for Bluetooth so I have a way to prevent it from automatically starting in my notes. These articles are generally based on my notes, so now you’ll know.

NOTE: I should probably also mention that this is really only useful for those of you who use systemd. If you still haven’t moved to systemd, or refuse to move to systemd, then this article isn’t going to be of much use to you. You can still do this, but you’ll have to do so with your particular init system’s commands. These commands are not gonna work for you.

Even if you don’t want to disable Bluetooth from automatically starting at boot, you may want to learn how to disable other services. The process for other services is pretty much the same as it is for Bluetooth. So, you can learn something from this article if you’re new to this whole thing.

This is a nice and easy article, it shouldn’t take much time to read and understand. So then, let’s get on with it!

Disable Bluetooth From Automatically Starting At Boot:

Yeah, that’s longer than it should be. Oh well… Blame the need to optimize for keywords! I try to keep ’em shorter, but here we are…

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, let’s first check the Bluetooth service status:

It may or may not be running. If it’s not running, odds are that Bluetooth isn’t set to automatically start at boot. You can ensure that it’s not set to automatically start with the following command:

Now, that’s the command you probably want. It’ll disable Bluetooth from automatically starting at boot – and it will still let the Bluetooth service start if you want it to later or if something else in the system calls for it to start. You can reboot and make sure the setting has changed, if you’d like.

On the other hand, if you ‘mask’ the service, like we did in the How To: Disable Sleep And Hibernation on Ubuntu Server article, you won’t be able to start the service at all. That’s the biggest difference between ‘disable’ and ‘mask’, in case you’re curious. Both of these options are better than manually deleting the services, ’cause you can undo the setting fairly easily. In fact, to do so with the Bluetooth service, you just:

After which, you should check the status again:

And all should be well. You can now reverse it after you’ve chosen to disable Bluetooth from automatically starting at boot. See? Pretty easy and handy information to have for other services. By the way, if you chose ‘mask’ then you’d ‘unmask’ the service, which seems like an obvious way to do it.

Closure:

See? I told you that this one would be pretty quick and easy. I’m kinda amazed that I haven’t run out of ideas for articles yet! I’m still chugging along, well after the initial year-long scope for the site. If I can do it, anyone can! I’m still very much open to guest articles, within reason.

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: Protect a file or directory from being deleted or changed by root

The following article is a guest article that will teach you how to protect a file or directory from being deleted or changed – even by root. This is a handy skill to have as you may have files you want to ensure are never changed.

This time, I’m going to do very little editing – but not out of laziness, but because I really don’t seem to need to do much. I really only need to do some formatting changes and we’ll be good.

Note: I forgot to ask the author if they want me to disclose their name. It’s a little late in the day now, as they’re in another time zone entirely, so when they see this they can let me know if they want their name credited/anything linked from it.

Without further ado…

Protect A File Or Directory:

Sometimes we come across files/directories in Linux that we don’t want to be changed. It won’t be long before we realize making a file “read only” through the GUI of our desktop environment doesn’t work the way we want to because the root user is still able to alter that file.

In this article I’m going to show you how to protect ANY file or directory from being deleted or changed even by the root user. For this example I’ll use xorg.conf which is nvidia’s config file.

Files:

In order to make xorg.conf immortal, as I like to call this process, open terminal and type:

and press enter. To make sure the file has become immutable, which is what the +i stands for, open it as root in your favorite text editor (sudo gedit /etc/X11/xorg.conf). Some text editors will allow you to write new content to the file but they won’t allow you to save the changes because the file is already immutable. Other text editors won’t react to pressing keys and there will be a “read only” string in the title bar next to the file name.

Undoing a file immutable is pretty much the same, with the only difference being that instead of a + you must use a minus symbol:

Directories:

You can also make a directory immutable or even a set of subdirectories. For this example open your home directory in your favorite file manager, then open terminal and type:

Now, here comes a little tricky part that you need to remember for the immutabling of the directories to work: placing a slash after the names tells the shell that dir2 is a directory and not a file. If you type /testdir/dir2, the shell will think dir2 is a file and will return an error.

If you have entered the command correctly, you will see this output:

If you have closed terminal, open it again in your home directory where you just created these two directories and type (exactly the way you see it, with the capital R and V):

-R stands for “recursive”, meaning it will do the same operation to all subdirectories, including dir2.
-V stands for “verbose” which will display what has been done.

In order to test this, simply select test dir and press Delete to try and delete it. You’ll see an error message which means testdir and the dir2 inside it have both become “immortal” and now nobody can delete them, not even root.

Undoing this is the same command, only instead of +i, you must use -i.

Closure:

And there you have it, a fairly well written article that I didn’t do much to other than some basic formatting. If there’s an error, don’t blame me! Ha! It looks right to me and jives with what I know on the subject, but I did not actually go through and test this. I trust the author to know what they’re talking about.

By the way, if you have a favorite subject and want to write an article, it really is that easy. Up in the upper right, click on the ‘contribute’ and I’ve made it even easier. (Don’t worry if it won’t let you pick a category, it’ll go through – and I still have to pick a category for it anyhow. All that does is save it as a draft for me to work on. It certainly doesn’t publish anything without my intervention. That’d just be silly talk!)

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.

Meta Article, Something like #9…

I’ve done a few meta articles over the past year and a half. Not all of them have really been ‘meta’, meaning having to do specifically with the site Linux-Tips.us and what’s specifically going on here. I want to say this is the 9th one? Something like that? Either way, we’re going to call it #9 and keep using that number as our starting base. I’ll make a point out of remembering it, and the next will be #10.

So, I figured I’d write one now… Why? Meh… I want a day off. I have an article I could edit and publish, a nice guest article that looks pretty solid, but I’m saving that for a few more days. I have a plan for that one – meaning I plan on enjoying my day off!

Like I mentioned the other day, it’s sometimes starting to seem like work. I publish every other day and that’s effort. If it’s work, I wanna get paid – and not the pittance Google AdSense provides. It’s never going to happen, so this needs to firmly remain in the hobby category.

So, what to write about?

I learned something new… It turns out that interactive websites have less activity during summer (northern hemisphere) months, though that doesn’t quite cover the decrease in traffic. No, that was something else – and appears to be on the upside.

Allow me to explain…

So Meta It’s Meta Meta!

You all may recall an article that made no sense. It stood out like a sore thumb and was so distantly related to Linux that it might not be Linux-related at all. It was even factually ‘questionable’.

Well, I’d be more than happy to give them their money back – ’cause that’s the only thing that really changed and I can cite it to the exact day.

I didn’t make much in the way of compensation, but thought it’d be a great way to help fund the site when I received an email asking if I’d accept paid guest posts that included a link or two. (They’re used for SEO purposes, as links from sites with good authority make Google like you.)

They paid me a pittance and I agreed to not mention (in the article) that it was a paid article. I also agreed to not disclose much, but they can have their 30 talons of silver back if they want it.

It was pretty much the very next day that traffic from Google slowed down.

Even though it’s automated, Google is not as mentally handicapped as we might think. No, no they are not…

There’s absolutely nothing else that can explain the drop in traffic – ’cause nothing else changed. So, I accepted my bribe money and Google spanked me. They spanked me like they’re dressed up like a nun, except I didn’t pay extra for it.

Fortunately…

My time in the penalty box appears to be over. Traffic from Google is once again climbing up. I’d share exact numbers with you, but this is an ‘easy’ article and I’m not gonna go taking screenshots and getting exact numbers.

Closure:

If you have a website and someone contacts you wanting to pay you for a guest article, run away. They paid me a paltry sum. Sure, they paid more more than I’d have made in ads, but it still wasn’t worth it to see the traffic slow down.

Yeah, that’s right… The ads pay so little that I still made more money from accepting the guest article. 

However, that’s now the site’s goal. Remember, it’s a hobby and not a job. At least that’s the goal. Any money made goes right back into the site. Currently, the ads are paying enough for me to pay for hosting and to pay for the CDN on a very low level. (It shouldn’t need much in the way of payment in the near future, so that’s fine.)

But, yeah… I accept the article and published it. In response, Google trashed the search engine traffic, sending less than half the traffic they had been sending. 

If you’re interested in short-term money, go ahead and take their offer for a guest article. If you’re interested in a long-term relationship with the people who frequent your site, or you’re interested in a higher calling (like educating new Linux users), then run away. If they ask for a guest article, run away and never speak to them again – even if it does pay better than AdSense.

I think I’m barely going to proofread this one. If you found errors, let me know. I’ll fix ’em when time allows.

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 Learn Some apt Basics

Today we’ll be learning a little about some apt basics. This is only useful if your distro uses apt to manage software. If you aren’t using a distro that does (Debian, Ubuntu, Mint, etc) then this probably isn’t an article that will interest you much, and that’s fine. With the great variety there is in the Linux world, it won’t always be an article that matters to you. Better luck tomorrow! Well, two days from now… 

In the past we’ve covered quite a few apt commands. Here are a few that are poorly formatted ’cause, you know, WordPress…

How To: Clear The apt Cache

Use ‘apt’ To Download A Program And Its Dependencies

Use ‘apt-cache’ To Find An Application’s Homepage

Those are a few – but there are actually more than that. If you’re unfamiliar with apt, you can click any of those articles and learn more about it.

For those of you whose systems use apt to manage packages, this article is for you. If you aren’t aware, apt is the package manager application that you’ll interact with more often than not (if you do things in the terminal).

Apt has a number of commands, of course. As a package manager, it’s bound to be a robust and potentially complicated application. Today, we’ll just be covering a few simple apt commands that you’re most likely to use. It will not be an exhaustive article because of time constraints, reader attention limits, and usefulness. My goal was never to replicate man pages. You’ve still gotta read ’em.

So then, without further ado…

Some apt Basics:

If you want to use apt, you have to have an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard. Press CTRL + ALT + T and your default terminal should open.

With your terminal now open, you can easily install applications with apt. You’ll need to know the package name for the software you want to install, however. So, you can search for packages easily enough:

For example, you can use ‘terminal’ in there as a keyword and get a ton of options, all of which should be installable easily. Again, these are just apt basics.

Now that you know, or you may already have known, the package name, you can install it with:

You don’t need to do the runaround with dpkg for local .deb files, by the way. I’m not sure why people still suggest that? If there’s a good reason for doing it that way, please let me know in the comments. You can just use apt and it works just fine – including resolving dependencies (when they’re able to be resolved). To install a local .deb file with apt:

If you want to get the information for a specific package, you can use the ‘show’ command. That’s easy enough:

If you want to see the dependencies, that is the other applications that need to be installed in order to make it work, then you just check the dependencies with:

If you want to remove a package with apt, then you can just read this article to decide which command is right for your needs:

‘sudo apt remove’ vs ‘sudo apt purge’

That’ll answer it nicely enough.

Closure:

There you have it. You have an article about apt basics, and that’s all it is. You’ll note that not all apt commands need elevated permissions, so there’s no need to use sudo unless you’re adding or removing software. The other commands can be run without elevated permissions.

There’s more to apt. Yes, yes there is. Type man apt and you’ll get an idea of the available options. This article is just some apt basics, the things I think you’re most likely to need on a day to day basis. 

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 Have A Look At The free Command

If the title wasn’t enough, today’s article has us taking a look at the free command. Once again, this will be a nice and easy article. I wanted to write a witty title, but Google doesn’t like witty titles for stuff like this and Google has been mad at me for a couple of months! Either way, it’s a good time for an easy article.

If  you’ve somehow never used the free command, you’re in luck! That’s what this article is going to be about! It should be relatively short, as there’s really only a few ways you’ll want to use the command.

What is the free command? Well, it’s an application that you run in the terminal (like oh so many of my articles) and it gives you some needed information about memory usage. It’s not fine-grained information, it’s about total usage. 

You can get this information all sorts of ways. Both top and htop will happily spit this information out. There are any number of GUI ways to get this information, such as your task and process manager may have a tab to tell you about memory usage. 

Us? No, we’ll be using the free command. The man page happily describes the free command as:

free – Display amount of free and used memory in the system

See? It’s another one of those terminal applications that does exactly what it says it’s going to do! Imagine that!

The Free Command:

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.

You can just run the command with nothing else:

That’s the same as you’d get if you ran free -w, by the way.

You can pick the display units as flags. Just look into man free to learn how to do that, but the easiest output for most people to read will be to display the units in megabytes or in ‘human readable’ form. You do those with:

Or the human-readable format:

Or if you prefer base ten:

Next, as you can see there’s a swap and regular memory section. If you have swap enabled, you can get some small benefit from seeing the total memory used. To do that, try this:

Finally, you can run the command periodically and get a running output so that you can monitor memory usage over time. That one’s pretty simple. The -s means seconds, so the following will refresh every ten seconds:

There’s more that can be done with the free command, so be sure to run man free in the terminal. However, those are the most common ways I use the command, so it’s likely to be fairly similar usage needs for you.

Closure:

There you have it, we have an article about the free command. It’s a good way to monitor memory usage, unless you need something more fine grained. If you want, there are are tools for that – including top and htop. But, those are fine article ideas for another time.

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.