How To: Reload Your .bash_profile

Today’s article is going to explain  how to reload your .bash_profile. It will be just a quick and easy article, one that won’t take up much of your time. It’s not all that complicated, but it’s something folks probably should know.

So, most of you will probably have a .bash_profile. There are other shells, but Bash is the most common. That’s where they store various bash settings. When you make changes to the .bash_profile, the profile needs to be reloaded for the changes to take effect.

I’ve probably covered this elsewhere, though I did write an article to show you how to find out which shell you’re using. If you don’t know, Bash is the name of the shell and stands for Bourne shell. There are many shells, but Bash was the first one ported to Linux. Indeed, it was one of the first applications ported to Linux. It’s still widely used as the default on most distros.

There are times when you’ll want to edit your .bash_profile for additional functionality. It’s where you’d go to change things like terminal output colors and you could even add aliases to the file if you really felt like it. (Those should probably bo in .bash_aliases, for the record.)

With that in mind, I’ll show you how to reload your .bash_profile.

Reload Your .bash_profile:

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.

Like I said, this won’t be a very long article. It’s not terribly complicated.

Let’s say you’ve made a change to your .bash_profile and you want it to take effect immediately. To do that, you enter one of the following two commands:

Alternatively:

You could also close all instances of the terminal and the new .bash_profile changes should take effect the next time you open the terminal. If you really want to have another way, you can reboot and the changes will take effect the next time you open the terminal as that too will reload your .bash_profile.

Closure:

See? I told you this would be a quick and easy article. It’s not all that complicated. You probably don’t need to reload your .bash_profile often, but now you know how to do so when you need to do so. Yup, it’s also another article. There are now more than 250 articles, by the way. Who knew that it’d turn into this?!?

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.

Remove A Swap File

In today’s article, we’re going to learn how to remove a swap file. This isn’t something I recommend, for reasons I’ll explain, but I have no ethical qualms about telling you how to do so. After all, it’s your computer. You get to decide what it does!

There are some folks who will tell you that if you have enough RAM you don’t need swap. Well, I am not one of those people. I tend to have swap enabled regardless of how much RAM I have. I have a good reason and I’ll explain it to you as best as I can. I mean, the actual inner workings of the kernel are above my head, but I’ll explain it – or let other people explain it.

See, contrary to popular opinion, swap isn’t just a place the kernel sticks stuff when you’re running low on RAM. For example, check out the picture below:

swap in use with plenty of free RAM
As you can see, swap is used even with plenty of free RAM.

Here’s more information about the free command.

Now, do me a favor and go Google Linux and swap. You’ll find plenty of pages that briefly have this to say (and barely this to say):

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full …

                                                                                                        That’s from MIT!

That’s only about half the story… There’s more to it, and that is kinda important.

Some More About Swap:

So, is it really that simple? Of course it isn’t! If it was really that simple, the intro to this would have been so much easier to write. No, it’s slightly more, a bit more, complicated than that. See, let’s quote a more thorough (and accurate) Linux.com:

Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.

                                                                                                     –Emphasis Mine.

What can we take from that? Well, it’s not just a place where the kernel stuffs things when there’s no RAM left – it’s also a place the kernel sticks things to avoid wasting RAM. This is very different than swap is just a place where the kernel stuffs things when RAM is low. It avoids using some RAM that’s best used elsewhere. That seems kinda valuable and important to me. Again, the inner workings of the kernel are pretty much witchcraft to me, but swap seems like a good thing to me.

The kernel is pretty smart about this, from what I’ve observed. It’s good at its job. It’s better at its job than you are. It is better at its job than I am. I highly encourage you to use swap, saving your RAM for more useful things. With disk space as large as it is, you’re not going to miss a couple of gigabytes. Let the kernel do its job, managing RAM as best as it can. They’ve put thousands of hours into making the kernel smartly deal with RAM, there’s no reason to hobble it.

Of course, ain’t nobody gonna listen to me… So, with that said, I might just as well go ahead and tell you how to remove a swap file… You’re gonna do what you want anyhow!

Remove A Swap File:

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 first thing we’re going to do is verify that you actually have a swap file…

If that mentions a swap file, only calling it a ‘swapfile’ (a single word), then your next step is to turn your swap off.

Now, for your next step you will want to remove the swap information from fstab, so let’s go like this to do that:

Find the line that starts with /swapfile and delete the entire line. All of it. Leave nothing behind. If you screw this up, your next boot may be an interesting exercise. The line is probably longer than it looks unless you’re using a terminal in full screen! Be sure to remove all of it. It should end with a 0, actually a 0 and then a tab and another 0.

Be doubly sure to remove the full line and then save your work. Then save it with nano. To do that, just press CTRL + X, then Y, and then ENTER. That’ll save it.

Finally, remove the swap file itself. That one is nice and easy, you just:

That should do it! If you’ve realized you’ve made a mistake and want to have a swap file, you can always add a swap file. (I’m pretty sure it should be ‘swapfile’, but the rest of the ‘net calls it ‘swap file’, so I’m going with the majority – even though the majority don’t even know what the damned thing does!)

Closure:

There you have it. You now know how to remove a swap file. If that’s what you want to do, you go right ahead and do it. Truth be told, assuming you’ve got enough RAM, it won’t necessarily break anything. You might not even notice it is gone. Still, I figure it’s better safe than sorry – and who am I to judge what the kernel wants?

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.

A Couple of Ways To Resize Images With ImageMagick

In today’s article, we’re going to go over a couple of ways to resize images with ImageMagick. It’s a useful skill to have if you’re into sharing images or the likes. This will actually be pretty quick and easy. I won’t take much of your time today but it’ll be longer than some other articles – but it really should be a quick read for you today.

It’s nice to not put full resolution pictures online – unless there’s a reason for the higher resolution. So, it’s a bit of a politeness to resize your images. I try to be considerate, ’cause I know what it’s like to have limited bandwidth. You people who started off in life with things like 100 GB fiber have no idea the pain we went through to get here! Alas, that whining is perhaps subject to another article, though probably not really a suitable article for this site. There are people who still use slow connections, and metered connections are entirely too popular.

So, what is ImageMagick? It describes itself as:

ImageMagick – is a free software suite for the creation, modification
and display of bitmap images.

ImageMagick is actually quite a useful application for quickly and easily manipulating images in the terminal. ImageMagick is so robust that trying to cover all of it in a single article would be foolish. I simply couldn’t do it within the bounds of a single article.

That’s why we’ll just be examining a couple of quick ways to resize images with ImageMagick. We couldn’t possibly cover it all today. If you want to see what all the options are, I’d recommend checking the man pages – and reading other tutorials that cover the things you’d like to do.

With that said and done, let’s resize some images with ImageMagick!

Resize Images With ImageMagick:

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 first thing we’re going to need to do is make sure you have ImageMagick installed. So, let’s install it. The command below is for those who use apt, but you can easily change it to your own package manager. I’m 99% certain that ImageMagick will be in your default repositories! It’s a pretty widely used application! The command for those of us who are apt-using people is simply:

Follow any on-screen prompts to install it, else it’ll tell you that it is already installed. ImageMagick appears to be installed by default on a number of distros, but it’s easy enough to install. You can actually just add a -y to it and skip some of the prompts:

Of course, you’ll still need to enter your password. Well, if you really want to live on the edge, you can enable passwordless sudo easily enough. I don’t really suggest that, but I do tell you how to do it. ‘Snot something for the faint of  heart.

Ah well… Onto the meat of the article!

Resize By Resolution:

Now that you have ImageMagick installed, let’s try resizing something. What we’re going to do first is resize it by way of the resolution. That is, we will resize it by declaring the new height and length. To do so, you’d use a command like:

For example, you might try something like this:

See? Pretty easy. I told you this wouldn’t be too hard – nor will this article be all that long. Well, it might be a bit longer than some, but I won’t let it be too long. I know my reader’s attention span! You should make sure to use the same base resolution. If the image is 16:9, your resized image should retain that aspect ratio. Otherwise, your images may appear warped and ugly.

I should probably mention that it’s possible to make images larger with this command. However, when you make an image larger you lose fidelity. Making an image too large is going to result in an ugly image. It’s not like the television where you can just keep zooming in and enhancing. Ones and zeros don’t work like that.

Resize By Percentage:

This is my favorite way to resize images with ImageMagick, unless I have a specific reason to resize images by resolution. In this case, you just declare a percentage of the original and ImageMagick does the rest. It’s really a very easy command. It looks a little like this:

If you want, here’s an example of how you can use that command to resize images by percentage with ImageMagick:

That command will make ImageMagick output a file that’s 50% smaller than the original image. Not only will this be a smaller image visually, it will have a smaller file size. Because of the way images work, this doesn’t mean the new file size, size on disk, will be reduced by 50%. It just means you’ve reduced the image’s dimensions by 50%. The size on disk will also be lower, but it’s not directly proportionate. 

Like above, where  you resize the image by resolution, you can use this to make images larger. The same caveats exist that existed above. That is making an image too large means it results in a poor quality image. As you can guess, making images larger isn’t always a good idea, but it’s generally fine if the operation is making the images smaller.

Closure:

And there you have it. You have another article! This time, we’ve covered how to resize images with ImageMagick. I think that’s a useful skill to have and it’s a quick/easy thing to learn. Of course, you can always check man imagemagick to check the man page. That man page will be enlightening, I suspect.

I’ve changed the format a bit for this article (though I’ve used it before), and made it a bit longer than the recent articles. If you have an opinion on the matter, please feel free to leave a comment. The more I know about your wants, the more I can tailor the content. The more I can tailor the content, the better you’ll enjoy the content. To do this, I need to know your thoughts on the matter. Speak up!

So, do you enjoy the longer articles? Do you enjoy the shorter articles? Do you appreciate a mix of them, and each article only being as long as it really needs to be? I normally try to keep all my articles friendly, informative,  and fairly strictly informal. Lately they’ve been pretty  short, but I can be more verbose, as many of you will have witnessed.

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 Microsoft Edge

Today, we’re going to learn how to install Microsoft Edge. That’s the browser made by Microsoft that even has a Linux version. That’s right, it’s from Microsoft but has a Linux version – and a version packaged for pretty much everyone.

We’ll be installing on Linux Mint, just to mix things up a bit. It’s really not that much of a change, it’s still using apt. It just so happens that I’m sitting at a Linux Mint computer when I’m writing this. We might as well use GDebi while we’re at it.

Yes, I’m well aware that many of you hate Microsoft with a passion. That’s fine. If you don’t want to install Microsoft Edge, just move on and don’t bother those of us who are curious about the browser. You’ll have another article in a couple of days, and it quite likely won’t have anything to do with Microsoft.

If you don’t know, Microsoft Edge is based on Chromium – which is the opensource version of Chrome, more or less. Chromium doesn’t have feature parity with Chrome, so it’s not quite the same version. Chrome is mostly based on it.

There are many browsers based on Chromium. Brave, Vivaldi, Opera, etc.? They’re all based on Chromium. There are only so many browser engines out there, and Chromium being opensource means people are going to use it. Microsoft jumped on the bandwagon with their Edge and made it available for Linux users. So, we’re going to…

Install Microsoft Edge:

This article requires an open terminal, but only for a minute. 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.

To keep things easy, we’re going to install GDebi. As we’re doing this on Mint, the command will work with any apt-using distro, the command to install GDebi is:

Follow any prompts to ensure you install GDebi properly.

Next, fire up your favorite browser and:

Click to download Microsoft Edge for Linux (make sure to get the right one for your distro). There are a number of choices, so pick the right version of Microsoft Edge for you.

Let it download, say to your Downloads directory. When your download is complete, right click on it and choose to open it with GDebi directly from the right click menu.

That part is easy, just let it do its preliminary checks and then  you can click on the install button (upper right) when it’s ready to be installed. Later, if you don’t like it, you can open the .deb with GDebi again and opt to uninstall the package. See? It’s pretty handy.

Closure:

I actually wrote a review of Edge before, but it’s on the old site and not really very good. Even if you can’t stand Microsoft, it’s not a bad browser. It’s not one that I’m going to use in my day-to-day browsing, largely due to lethargy, but it’s still a viable browser.

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.

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.