How To: Remove A Package With YUM

Today’s article is pretty basic, as the title so helpfully implies, as it simply tells you how to remove a package with YUM. I am writing this article because of a comment sent to me via the contact page. The gist of the comment is that I seldom include information about YUM but lots of information about APT.

I welcome such. If I didn’t, I wouldn’t have the option to contact me! In a similar vein, if I didn’t welcome comments WordPress would happily allow me to disable said comments. I welcome all that sort of stuff, even including the comments I get elsewhere. For the record, some of those comments are so good that they’d be welcomed additions to the articles themselves. Alas, so few people seem inclined to do so and their helpful additions are lost to the aether.

Anyhow, back to the comment sent via the contact page…

The person sending me the message is correct. It’s true. More often than not, I only include information about APT. In my defense, other than servers or playing around in virtual machines, APT is my usual weapon of choice. I’m familiar with it, indeed comfortable with it. As such, my brain just kinda defaults to it.

So, what is YUM? Well, YUM is like APT for people using RHEL, CentOS, Fedora, Rocky, and quite a few other choices, might I say professional, operating systems. While the numbers I can find indicate the APT-using distros dominate the desktop market, it’s almost certain that the server market is dominated by people using a distro with YUM as the package manager.

YUM stands for Yellowdog Updater, Modified. It is the package manager for distros using the RPM (Red Hat Package Manager) formatted, or standardized, packages. It is very old and very stable. Those are not bad things, especially in the server and professional markets – where things like stability are prized. If you used YUM back in the day, I have good news for you. It hasn’t changed! Well, not significantly, as Wikipedia happily tells me that the last stable version was about eleven years ago at the time of this writing. Again, that is not a bad thing! I can’t stress that enough.

Because I don’t cover YUM enough, I figure a nice introductory article will be good. It’ll be a good thing to expose folks to YUM when they’re mostly just familiar with APT. As such, I figure some basic commands are a good place to start. 

So, let’s get to it…

Remove A Package With YUM:

Of course, you use YUM in the terminal. That means you’ll need to have an open terminal. In most distros, you can just press CTRL + ALT + T and your default terminal should open. If this doesn’t open your terminal, you can almost certainly find a quick and easy way to modify your keybindings.

With your terminal now open, the process is pretty simple to remove a package with YUM. The command would look something like this:

You can also use the following format:

Those commands will only remove the package you named. So, if you removed a program like Thunderbird, your configuration files and any dependencies will (should) remain on the system. This is useful for when you need to reinstall an application but want to try keeping your existing configuration.

If you want to also remove your configuration files and any dependencies, YUM will happily allow you to do that. To do so, that is to remove the application, any configuration files, and dependencies, you’d try a command like this:

While it may look similar, it functions differently than autoremove functions in distros like Ubuntu. So, the syntax may look similar, but there are differences between the commands and it may be prudent to remember that. After all, the goal is to remove a package with YUM and not APT.

If you want to get fancy, you can add the following to your /etc/yum.conf to make sure that when you remove a package with YUM it will automatically remove the dependencies and configuration files:

However, adding that command will mean you do exactly what I said you’d do if you did that. You will also remove your configuration files and any of the application’s dependencies. If you’re sure that’s what you always want to do, you can do it! Ain’t Linux awesome?!?

Closure:

Well, I wanted to write an article about YUM for our RHEL-using peers. I didn’t want it to be too basic, so I figured I’d add a little more to it. The reality is that I don’t cover other distros that often but, in my defense, this is largely aimed at making Linux approachable – or, as the tagline says, “Getting you up to speed.” Most of my readers are going to be using distros with APT and much of my content is generic enough to apply to any major Linux distro.

So, there’s that… If you want to see even more of this type of content, leave a comment (here, preferably) to let me know. I ain’t scared! If this is the type of content that suits you, that’s great and I can write more of it. It’s not hard to include the commands for other distros, it’s just time-consuming.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Play Around With The Linux Shell.

Today’s article is a bit of a mystery, as I’m writing it and not sure how it’s going to end up – but it will be about the Linux shell. I’ll try to make it approachable, even for beginners. Let’s see where the article takes us!

I think I’d caution most beginners to stick with what came with their distro (most likely Bash), rather than straying into the world of different shells. Wait until you have a few more miles in your Linux shoes before running to try new shells. It’ll make support easier if you don’t have to compound things by using an alternative shell. Once you’re up to speed, there are some nifty choices.

This seemed like the perfect question to pose ChatGPT. I’ve found a way to make AI useful – or so it seems to me. I asked the AI to explain the Linux shell in two paragraphs. This is what they had to say:

A Linux shell is a command-line interface (CLI) program that allows users to interact with the Linux operating system by entering commands. It acts as an intermediary between the user and the kernel, which is the core of the operating system. The shell provides a text-based environment where users can execute various commands to perform tasks such as navigating the file system, running programs, managing processes, and configuring system settings.

The shell interprets the commands entered by the user and translates them into instructions that the kernel can understand and execute. It also provides features like command completion, history, and scripting capabilities, allowing users to automate tasks and create powerful scripts. There are different types of shells available in Linux, such as Bash (Bourne Again SHell), which is the default and most widely used shell in Linux distributions. Other popular shells include Zsh (Z Shell), Ksh (Korn Shell), and Csh (C Shell), each offering its own set of features and functionalities. Overall, the Linux shell is a fundamental component of the operating system, providing users with a flexible and efficient way to interact with the system.

That looks like a pretty good description to me. If you have any questions, you can certainly leave a comment. You know where to find me so that you can ask questions most anywhere.

Hmm… As I said, I’m not sure where this article is headed. We’ll have to see…

Some Stuff About The Linux Shell:

Pretty much every single one of the new folks reading this will have something in common with those who have used Linux for years. You’re almost certainly using Bash as your shell. Bash stands for Bourne Again Shell. Bash is the Linux equivalent of Bourne Shell that came with Unix back in ye olden days.

If you want, you can open a terminal at this point. Odds are that you have another shell or two available. You can list your shells with the following command:

If you don’t already know what shell you’re using, you can find out quickly enough. Just run this command to find out which shell you’re using:

Let’s pretend you’re using Ubuntu and want to install a new shell. Let’s pretend you are interested in ZSH. That is ‘Z Shell’ and is an alternative that you might consider. The first step would be to install ZSH and you’d do so like this:

Follow the prompts and when you next run cat /etc/shells again, you’ll see that ZSH is an option. Pay attention to the path. It will look like /usr/bin/zsh and you can change to that shell quickly enough. Just run the following command:

Or, for a better example:

You’ll then want to reboot your system. That’s easily done with:

That should do the trick for pretty much everyone, though you’ll need to use your package manager if you’re not using apt with Debian, Ubuntu, Mate, or similar. It’s easy enough to switch to a new Linux shell – but you should probably have a good reason for doing so.

By the way, feel free to leave a comment if you use a different shell, preferably explaining why you’ve chosen to do so. I’ve played with different shells and that was entirely my reason for doing so, I just wanted to play around with them. I stick with Bash pretty much exclusively, or whatever’s installed by default.

Again, I’d caution you newer users to skip this article and just use this pile of words to learn about shells in the first place. If you’ve been using Linux for a while and want to learn something new (or have a specific reason to do so) then you can change your shell as much as you’d like. It’s your computer, you can do anything you darned well want with it!

Closure:

So, I wasn’t sure what this article was going to look like. I just figured I’d do an article about the Linux shell. We all know at least one beginner is going to start mucking about with alternative shells, at least this way we can tell them that we suggested they wait to do so.

Then again, how often did we wait to do so? How often did we go mucking around with things best left untouched until we learned better? At the end of the day, Linux is an OS that suits those who like to tinker, but she can be a harsh mistress when you’re still learning. And, again, how many of us learned by breaking things? I reckon many of us did and that’s how we got here.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Change DNS Servers

Today’s article shouldn’t be all that difficult for even our newest users but is limited to those who want to change DNS servers to something other than the default. This is easy enough to do, but obscure enough to warrant an article of its own. 

First, let’s have some fun. I’m going to ask ChatGPT to tell you about DNS in just two paragraphs. So, let’s see what the AI has to say:

First, what is DNS?

DNS, or the Domain Name System, is a fundamental protocol used in computer networks to translate human-readable domain names into machine-readable IP addresses. It serves as a decentralized directory system that enables users to access websites, send emails, and perform various network activities using familiar domain names instead of numerical IP addresses. When a user enters a domain name in their web browser, the DNS resolver (typically provided by the Internet Service Provider or ISP) initiates a series of queries to locate the corresponding IP address. The resolver communicates with DNS servers, starting from the root servers, then the top-level domain servers, and finally the authoritative name servers associated with the requested domain. Through this hierarchical process, DNS ensures efficient and accurate resolution of domain names, facilitating seamless internet connectivity.

DNS operates through a distributed database system known as the DNS namespace. This namespace is organized hierarchically, with the root domain at the top, followed by top-level domains (TLDs) like .com, .org, or country-specific domains such as .us or .uk. Beneath the TLDs, there are second-level domains, and further subdivisions like subdomains. Each domain has authoritative name servers that store the IP addresses associated with the domain names they manage. DNS resolution occurs through recursive queries, where the resolver traverses the DNS hierarchy to find the authoritative name servers responsible for the domain. Once the IP address is obtained, the resolver caches it for future use, reducing the need for repetitive queries. DNS plays a crucial role in the functioning of the internet by providing a scalable and efficient method for translating domain names to IP addresses, enabling seamless communication and accessibility across the network.

Wow! That’s pretty accurate. I’d have just resorted to describing DNS as the telephone book of the internet. You look up the name you want to reach and DNS tells you the number. In this case, the number is the IP address.

All in all, I’d say ChatGPT did a pretty fine job.

Change DNS Servers:

There are a variety of reasons why someone would want to change DNS servers to something else. They may get updated more quickly, weed out junk domains, or even remove ads and things like that. Maybe you want to weed out inappropriate material because you have children. Perhaps you have some custom configurations needed to traverse your complex local network. There are all sorts of reasons why you might want to change DNS servers.

See, as alluded to above, it’s perfectly possible to run your own DNS server (see Pi-hole for one such example). You can also use DNS servers provided by various third parties. For example, CloudFlare and Google offer their own DNS servers that are free for you to use. There are other choices, but this isn’t an encyclopedia writ large, so I’m going to just include those two. You can use your favorite search engine to find more.

So, let’s say you don’t like using a DNS server provided by your ISP. Perhaps you do this because of privacy issues, though you can look into DNS over HTTPS if you’d like. Perhaps you just don’t find them updated quickly enough or you’ve found they contain errors. (They do sometimes have issues and have even been known to be exploited in the past.)

NOTE: We’ll be using ‘nano‘ for this exercise. We’ll also default to Google’s public DNS servers, but you can substitute with whatever you find available.

Well, the first step you’re going to take is opening your terminal. You can do that by just pressing CTRL + ALT + T. In most distros, that will open the default terminal emulator. If your distro doesn’t do so, start mucking about with the keybindings until it does!

The file we’ll be editing doesn’t actually exist on most distros. That’s not a problem, because we’ll be making that file with nano. With your terminal open, enter the following command:

That should be a perfectly blank file and you’ll want to enter the following (again, using Google’s public DNS servers) to change DNS servers:

Then, you’ll save the file with Nano. That’s pretty easy. To save this new resolv.conf file with nano, you just press CTRL + X, then Y, and then ENTER.

Next, you’ll need to reboot. I know this will pain some of you, but I’ve yet to have a sure way to effect these changes other than rebooting. So, you’ve gotta do that. Try this command:

Now that you’ve managed to change DNS servers, you should be able to browse around much as you normally would. Remember, the people in charge of the DNS servers are the ones that decide where you go when you enter an address into the address bar and smash that enter button.

Be sure to use a company you trust to provide those services and be sure to verify your internet is still working properly. If it’s not working, you can remove the file and reboot or you can edit it again and try rebooting again. It shouldn’t be a problem in reality, this isn’t anything all that complicated.

Closure:

So, there you have it. It’s yet another article. This time around we discussed how to change DNS servers – along with some reasons as to why you might want to. If you have a spare bit of hardware kicking about, you can make your own DNS server and point to that with the internal addresses you’d be using. It’s nothing too painful and I think even beginning Linux users can follow along easily enough.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Count The Number Of Files In A Directory

Today’s article probably isn’t all that useful unless, of course, you want to count the number of files in a directory. This can be useful if you want to quickly see if all the files were copied over or the like. Maybe you’ve made a backup and want to ensure the number of files matches. Who knows? It’s your terminal, you do what you want!

This article comes from my notes. These notes were right next to the notes used for the last article, where we learned to count letters, words, and lines in a file. I did get some feedback about why some folks want to know that information, which is always good feedback as far as I’m concerned. It’s great to learn the ways you put these commands to work.

Seeing as I’m lazy and just using the next notes in line, we’ll be using the ‘wc’ command again. If you didn’t read yesterday’s article, or got here by way of a search engine result, then the wc command describes itself like this:

wc – print newline, word, and byte counts for each file

You can expect the wc command to be included in every distro. It is a fundamental application and small enough to be a default application. Even the tiniest desktop distros will likely have this application and you won’t need to install anything. You will need an open terminal.

Count The Number Of Files In A Directory:

As I said in the intro, you’re going to need to use the terminal. Regular readers will notice a trend. We use the terminal a great deal. Just press CTRL + ALT + T and you should be good to go. (Some distros don’t do that as a standard. I’m looking at you, Elementary OS.)

With your terminal now open, navigate to your favorite directory with:

For example:

Then, when you’re there, try the following command:

You can also specify the path, just like you would with the regular ls command. That’d be something like:

If you want to count all the files, including the hidden files, the command would be quite similar:

In case any of this is unclear, I’ve made an image showing how I can count the number of files in a directory with a few similar commands. It looks like this:

using the ls and wc commands together to count the number of files in a directory
See? If you want to count the number of files in a directory, you can do that!

As always, be sure to check the man page for both of these commands:

And:

So, have fun counting the number of files in a directory – while learning a bit about ls, wc, and the almighty pipe (which I’ve not yet written about in any great detail).

Closure:

Of course, I hope you have fun with this one. I’m not sure how many creative ways you can use this set of commands, but it’s nice to use the pipe in an article, even if it’s just one where we count the number of files in a directory. We did use it in a fun article about cowsay and fortune. It has also been used in a few other articles, but we should have an article all about 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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Count Letters, Words, and Lines

Today’s article isn’t going to be all that interesting unless you happen to want to know how to count letters, words, and lines in a file. If you’re worried about publication length, a student, or perhaps a journalist, this might be the article for you.

For everyone else? Well, you can read this as a curiosity. It’s one of the neat things you can do with your Linux terminal, but probably not the most interesting of things. Still, you can probably find a way to have fun counting letters (characters, really), words, and lines in the Linux terminal. Who doesn’t want to have fun in the terminal?!?

The tool we’ll be using is ‘wc’ and it will almost certainly be installed by default. The wc application will be installed by default on some of the smallest Linux distros. It’s a tool that does this:

wc – print newline, word, and byte counts for each file

That happily sums up why we’ll be using wc in this article’s exercise. It is the most appropriate tool for the job, installed by default, and remarkably easy to use. If you want to count a file’s letters, words, and lines, this is the tool for you. You can learn a lot about this very tool by checking the man page. To do that, just type:

If that doesn’t spit out some information, you don’t have wc installed and should install it. Assuming it does, and it should let’s get into the meat of the article…

Count Letters Words And Lines:

Oh yes… I mentioned the terminal in the intro. That means you’ll need an open terminal for this. It isn’t easy to word this differently in every article, but you can just press CTRL + ALT + T and your default terminal should open.

With your terminal now open,  you can first count the letters (characters) in a file. That’s nice and easy. It’s just this command:

For example, let’s use a file most of you will have:

See? Nice and simple…

Now, if you want to count the words in a file, that’s just this command:

Finally, if you want to count the number of lines in a file, you can do just that. The command is fairly obvious and looks like this:

Now, of course, there are other options with the wc command, but I’ve covered the few that you’re most likely to use. The intro had a command that will show you the man page and you should use that if you have any questions about what more the command can do.

Closure:

Yeah, this is a nice and simple article. It’s only useful for those folks who want to count letters, words, and lines. There’s a subset of users who will want to know this. For instance, I ran this on a computer I don’t use that often and discovered that I’d never set up an infinite bash history file on this computer.

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 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.