How To: Show All Environment Variables

Today’s article is going to show you how to show all your environment variables in Linux. There are quite a few and some of them can be quite useful. If you don’t know what an environment variable is, we’ll cover that briefly as well.

So, what is an environment variable? It’s a static name for a dynamic value. In other words the system has information that varies, but using an environment variable will point to the dynamic information as though it was static.

As an example, we can use ‘echo $PWD‘ in the terminal and it will output the present working directory. If you change the directory and run that command again, it will output the new present working directory. You can do things like ‘echo $SHELL’ and it will tell you the shell you’re using, even if you’ve changed from the default shell. Things like that are the point of having environment variables.

These things really shine when used for things like scripting. They’re useful when you’re not certain of the architecture they’ll be used on and still want the script to work predictably wherever it is used. You’ll also see environment variables put to work in programming. They’re pretty handy, as I said!

If you’d like to see an example, read my article about clearing EXIF data for privacy’s sake. Scroll down to find the alias example I included and you’ll see the $PWD environment variable at work. See? It’s pretty easy and effective. So, let’s see a few ways to show all environment variables.

Show All Environment Variables:

Like most articles, you’re gonna need an open terminal. You can do that with your keyboard, by pressing CTRL + ALT + T and your default terminal should open.

Now that you have your terminal open, we’ll start with the first way to show all the environment variables:

You can also use:

You can also use the following command, but I don’t recommend doing so. It’s here for the sake of completeness and the command will output a lot of gibberish that’s really of no value to the average user.

Now that you know how to show them, here are a few handy examples that further demonstrate what an environment variable does.

Show home with:

Find the system language with:

Or find the desktop environment in use with:

Those are just a few of the environment variables available to you as a Linux user. If you make use of these on a regular basis, please leave a comment explaining how you use them.

Closure:

Yup… Another article. Another step closer to the anniversary of this site. I still have some content to move over from the original site, but writing completely new stuff is pretty fun. Seriously, it’s pretty fun. Please feel encouraged to write an article or two, considering I normally take the whole month of January off!

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: String Commands Together In The Terminal

Today’s article is about how you can string commands together in the terminal. You can do so in a few different ways, for a few different reasons. This article will explain some of those to you, hopefully making your life easier.

There are a number of reasons why you’d want to string commands together. I find it easier to just run certain commands together. I also find it easier for some aliases. (Speaking of which, I really need to do an article about aliases!)

For example, you might want to run change to the Foo directory and then list the files inside it. Well, one way to write that command would be cd Foo && ls -la. In that case, you’d change the directory to Foo and then you’d list all the files within that directory. As I said, there are a number of ways to do this and a number of reasons why.

This article won’t be all that long – or even all that difficult. But, this is a pretty basic skill you’d want to have if you’re working in the terminal. It’s one of those tools you’ll (maybe) find yourself using more often once you’re used to it. I, for one, use it with some frequency. You can string commands together and then go make coffee!

String Commands Together:

Obviously, you’re going to need 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.

With your terminal open, you’ll want one of the following operators:

; run the next command no matter what.
&& run the next command only if the first one succeeds.
|| run the next command only if the first one failed to run.

The ; operator can be used something like this:

Them the && operator can be used something like this:

Finally, the || operator can be used something like this:

You could string them along something like:

See? It’s not all that complicated. You can also swap the ; operator for a single ampersand. It’ll do the same thing, run the following command regardless of the results of the first. So, cd Downloads ; touch foo and cd Downloads & touch foo are functionally the same.

Closure:

Yup, another article – said and done. This one is, as promised, not all that difficult or even all that long. Still, I hope you’ve learned something and know now how to string commands together in the terminal. It’s a pretty useful skill to have. Feel free to leave a comment explaining how you already use these operators to string commands together.

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: Mount An .iso In Linux

Today’s article will teach you how to mount an .iso in Linux, a task undertaken seldom but worth knowing. This isn’t something I use often but it’s something you may want. It promises to be a quick and easy article, so read on!

I’m pretty sure the ‘unmount’ is incorrect English and that it’d be ‘dismount’ if you had mounted something like a horse or gym equipment. But, when I look around the web I see ‘unmount’ used with greater frequency. So, I’ll be saying ‘unmount’, even though that seems wrong.

Why would you want to mount an .iso? Well, there’s software that’s meant to be run from CD/DVD. You could burn your .iso to optical media or you can just mount the .iso and use it from there. Rather than wasting time burning the disk, you might just as well mount it.

You might want to verify that the image works before you burn a copy or upload it to share it. You might want to make edits to an .iso image and mounting the .iso will help with that, as you’d obviously unmount the image between changes.

So, you have a few reasons as to why you might want to mount an .iso. This article will explain how. It might not be a skill you need to day, but it’s one you may want eventually. We might as well get it written down now.

Mount An .iso In Linux:

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 command you need to run is to set up the mount’s directory:

With that done, you can navigate to the directory where your .iso is stored or just use the full path. Your command should look a little something like this:

When you’ve done that, the .iso should be mounted and remain mounted until you unmount it or reboot. This is not a permanent mount, so you’ll not have any permanent changes to your system because of this. For permanency, you’d need fstab.

By the way, just cd /mnt/iso to navigate to your newly mounted iso and that should work just fine. If you want to unmount the .iso on your own, you’d just use this command:

You can verify that you mounted and unmounted it with the lsblk. The output from that command should first show the .iso mounted and then show it when it’s unmounted.

Closure:

That’s about it. There’s not much more to say about how you mount an .iso in Linux. It’s a pretty simple activity and one easy to master. In my case, I just do it so infrequently that I never actually remember all the commands. So, it ended up in my notes – which means it turned into an article.

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: Update OpenSUSE Tumbleweed From The Terminal

It’s time for an article that describes how to update openSUSE from the terminal. After all, I’ve done so for Ubuntu and Fedora. I might as well do one for openSUSE. It seems like a good thing to do.

While most of this site is aimed at bringing you up to speed, making Linux easier, it’s also biased towards desktop Linux users. Well, today’s distro isn’t really all that popular in the desktop sphere, it’s more a server distro. There is a desktop version, and it’s a pretty great distroy.

So, to avoid confusion, “SLES” stands for SUSE Linux Enterprise Server. It is a paid product with an excellent pedigree and a great reputation in the community. openSUSE is the community edition of that software. openSUSE is mostly used on the desktop, as a workstation distro.

Over the years, I’ve tried openSUSE here and there and found it to be functional, stable, and easy enough to figure out. There’s a lovely rolling-release version of openSUSE that’s called ‘Tumbleweed’. If you have a hankering to try openSUSE, go for it and give Tumbleweed a shot!

A shout-out to a Linux.org user: Gecko Linux is based on openSUSE.

Oddly, it’s often harder to write the intro than it is to write the meat of the article. It can even take more time to write the intro than it takes to write the rest of the article. This article is likely to be one of those. 

Ah well… On to the article!

Update openSUSE From The Terminal:

You’ll need 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.

First, you need to refresh the database of what software you have vs what software is available. Obviously this means comparing version numbers. This is a necessary step, otherwise it’d be updating blindly and that’d make no sense! So, the command you’re looking for is:

That will run its course and take some time. On a rolling release, you can expect quite a lot of updates to be available. When it is finished, and you’re ready to do the updates, you can just enter:

That’s actually all there is to it, at the base level. There’s still more, as there always is. There’s always more! If you have run the refresh command and want to see what upgrades are available, you can do that with this command:

But, that’s about all you’re going to need to know. Like always, check the man page. It’s not terribly difficult to update openSUSE, anyhow. It’s straight forward in both the terminal and GUI. My personal preference is to use the terminal.

Closure:

Woohoo! There you have it! Here’s another article and this one is showing you how to update openSUSE in the terminal. It’s not terribly difficult, but it’s worth knowing. Not too many people use openSUSE and even the best of us might be unfamiliar and need a hint.

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: Determine Your Desktop Environment

Today’s article will help you determine your desktop environment. Often abbreviated as “DE”, your desktop can be any number of choices – including none at all. This should be a relatively short and easy article. If you don’t know, the desktop environment is a bunch of software that provides the GUI system you use to navigate, load files, and manage your computer.

Once in a while, an article should get back to the basics. This is one of those articles. When someone poses a question and you need to know their desktop environment, you can just tell them that you need that information and link to an article like this one.

As such, it’s not exhaustive nor is it expected to be all that deep. There are a number of ways to get your desktop information. For a more universal approach, these ways will all be through the terminal. In most other situations, you can use the GUI and figure it out. For example, you might use HardInfo and get the data that way. Not everyone will have that installed, so we can just do it though the terminal.

Determine Your Desktop Environment:

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.

Now that you have your terminal open, you can try either ‘neofetch‘ or ‘screenfetch‘. Both of them will happily spit out the information you need. The screenfetch may be better here, as it also gives the version of your desktop environment – from what I can tell. Both are easy to install and may already be installed.

Here’s an example of the relevant output from running screenfetch in the terminal:

screenfetch displaying desktop environment information
See? It’s right there! Easy enough!

You can also do the same thing with running neofetch in your terminal. Once again, it looks something like this:

neofetch showing desktop environment
Once again, it’s nice and easy! Tada!

Now, there’s some chance you just want to determine your desktop environment and don’t need or want any additional information. You can do that. It’s not hard, it’s not hard at all. In fact, both are environment variables that you can easily get to echo as stdout.

You can also use:

Both of those will tell you the desktop environment that you’re using. See:

using echo to view the desktop environment
See? You can use either one effectively and efficiently.

As suggested by @wizardfromoz, of Linux.org fame, I completely forgot to include my beloved inxi. The inxi system information tool is increasingly installed by default, but the link will show you how to install it. It’s a great tool, providing a ton of information, that’s used frequently for support questions.

To use inxi to determine your desktop environment, you can just run:

That’s an uppercase S and it’ll look something like this:

inxi showing the desktop environment
See? It’s even included in the inxi output! inxi does it all!

And there you have it, a few different ways to determine your desktop environment from the terminal. You should probably just know this information, but newer users may not know and may need help in finding this information. 

Closure:

So, there’s another one… Yet another article, said and done. This one is pretty easy and aimed at rank beginners, but it’s not without use. It may even save some time as people might actually search before asking questions! Well, they could… 

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.