Today, We Have Fun In The Linux Terminal

Today, we will learn nothing of value – except how to have fun in the Linux terminal. You know what they say, all work and no play makes Jack a dull boy. So, today we’ll be doing some playing.

Why? Well, because it’s fun. There are a number of fun things you can do in the Linux terminal, but this article is only going to cover a few of them. All of these are harmless, some perhaps even fun to share with a co-worker (perhaps even mischievously) and some just to make you smile.

For the sake of brevity, I’m just going to write this from the perspective of an Ubuntu user. You should be able to find equivalents for most every major distro, but that’s up to you. I mean, it’ll work in Debian and Mint etc, but you’ll have to hunt for yourself to find them in Arch, Fedora, or Gentoo!

So, without further ado…

Fun In The Linux Terminal:

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.

Once you have your terminal open, let’s visit the Matrix!

cmatrix:

Start this off by installing ‘cmatrix’ with this command:

Next, in your terminal, type ‘cmatrix‘ and watch the screen. It’ll look something like this as the text flows by:

cmatrix in action
With the new Matrix coming out… Feel free to run this when nosy people look over your shoulder!

See the man page for more detailed usage. Or not… It’s just for fun!

sl (Steam Locomotive):

This one is for those times when you fat-finger ‘ls’ and type ‘sl’ by mistake. My screenshot abilities were lacking with this one. So, you’ll have to make do. 

To install ‘sl’, just do this:

The next time you mistype ‘ls’ you’ll see what it does. Of course you can just type ‘sl’ and not wait for it. If you do so, be prepared for a steam locomotive that looks a little like this:

sl in action
Choo choo!!! It makes a more complete train, I just suck with graphics.

That’s sure to brighten a day such as the one where you’d be mistyping ‘ls’. Who doesn’t like trains?!? Sad people. Sad people don’t like trains.

Toilet:

You’ll find that toilet is a free version of figlet, a tool for making text larger for things like banner printing. I don’t think too many people have printed banners since the end of the dot matrix era, but it’s fun to play around with in the terminal.

To install toilet, and its wonderfully juvenile name, you just use:

There are a number of advanced features, but you can just type ‘toilet <text>’ and press the enter button. For example, there’s this output:

toilet in action - showing large text
There you have it, a giant KGIII! Just what you wanted for your birthday!

Again, go through the man page for more options – like the ability to choose a font and size. Have fun with it!

Closure:

See? Just like I promised, you’ve learned nothing of value. You can use ‘sl’ on a co-worker, frighten people on a train with cmatrix, or make large ASCII text in the terminal to amuse yourself. Yup, nothing of value! You’re welcome!

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: Make A Directory In Linux

Today’s article will teach you how to make a directory in Linux. Making a directory in Linux is pretty basic, straightforward, and easy. There are some options when making directories which we’ll be covering, but we’ll just be using ‘mkdir‘ for this exercise.

You’ll find the man page describes mkdir eloquently enough:

mkdir – make directories

And that’s exactly what it does. It’s a tool for making directories. Again, it’s pretty straightforward.

If you want a decently useful directory structure, you’re going to want more than the default directories. You’re going to want to make a consistent and meaningful directory structure, which will save you quite a bit of time and effort. Life is easier when you have a useful directory structure that makes sense to you – making things easier to find.

In case one doesn’t know, you can use ‘folder’ as a synonym for ‘directory’. It’s a hierarchical marker to which files can be designated – meaning you can stick stuff in your folder if you want to. They’re one of the best ways to organize your files in a meaningful fashion.

Like files, there are permissions for folders. Often, those permissions are inherited by the files within, though that’s not strictly necessary. We’ll lightly cover that as well.

For such a simple subject, there’s a bit of meat to it. We’ll cover that too in this article about how to make a directory in Linux. It’s mostly a beginner oriented article, but there may be some options that are unfamiliar more advanced users.

On to the article!

Make A Directory In Linux:

This article requires an open terminal, just like many other articles on this site. You can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have your terminal open, you can change directories or make these practice directories in your home folder (which would lead to clutter). So, if you want you can run mkdir tmp && cd tmp to get a fairly clean workspace going. (See? We’re using mkdir already!)

Anyhow, a nice basic use is to make a directory. To make a directory called ‘foo’ then you’d simply use:

If you want to make parent and child directories, you can also do that with just one command:

You can even make multiple directories in the same directory. That’s just a simple use of brackets and looks like this:

If you want to set permissions at the same time, that’s also an option:

You can also add the -v flag (meaning ‘verbose’) to any of these commands. That will output the results of your command so that you can verify that the command actually created the appropriate directories. After all, you never know when you’ll fat-finger something.

Closure:

There you have it! It’s another article, this one teaching you how to use the mkdir command to make a directory in Linux. This article is not terribly difficult, but there are a few advanced options that can make your file management even better. It’s a handy set of flags to know if you’re keen on keeping your system free of clutter.

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: Find Your Present Working Directory

There are times when you need to know your present working directory. You may need to know because the terminal doesn’t output that data, you may need to know for scripting, you may need to know for a variety of reasons.

So, what is the present working directory? Well, it’s simply a fancier name for the directory you happen to be working in – usually in the terminal. If you open your terminal and type something like cd Downloads, then your present working directory is going to be something like /home/<user>/Downloads. It’s pretty simple and this is going to be a pretty basic article. It’ll be a nice and easy exercise, even for a newbie.

There are a couple of ways to determine your present working directory and we’ll share them with you today. It’s really not a very complicated article, and not all articles need to be complicated. Sometimes, you just need new information that will help get you up to speed with your Linux understanding. After all, that’s the stated goal of the site.

Your Present Working Directory:

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.

As I said above, there are a couple of ways to do this. With your terminal open, why don’t you type something like cd Downloads just to have a different directory than your default directory.

When that’s done, just enter the following command:

The output should look a little something like this:

present working directory
See? It’s all pretty basic information that you’ll need to know.

But wait, there’s more! There’s also an environment variable that will show you your present working directory. It’s pretty simple and you can use it like this (among other ways):

Be sure to make note of the dollar sign and the all caps. You’ll need to include those if you want it to work. Depending on what you’re doing, you may want to use the environment variable (as I understand, it’s better to do this when  you’re scripting).

You can see an example of $PWD usage here.

Closure:

There you have it, another article. This one shows you how to determine you present working directory. As far as articles go, this one is pretty short and easy, aimed at newer Linux users.

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: Happy Holidays!

This is a meta-article from Linux Tips. I figured many folks will be celebrating the holidays and that this was a good time to take it easy. Oddly, my family tends to do everything the evening before Christmas, so I’ll be around today.

It’s this time of the year that many people are celebrating various holidays and we here at Linux Tips can do some celebrating as well. It’s amazing how well the site has done. I figure I’ll share some quick stats with you.

We’re up to 128 articles on L-T.
This month we’ve had an average of 290 daily visitors.
There’s about 118 unique visitors per day.
The site is chewing through ~8 GB of traffic per month.
Google supplies the most unique visitors.
Linux.org supplies the most repeat visitors, Reddit is a close second.
Neofetch vs. Screenfetch is the most popular article.
The second most popular disables sleep and hibernation.
Third most popular is about BalenaEtcher.

Ads and donations don’t even begin to cover the cost of hosting, never mind covering my time. That’s okay. I’ll continue to write and the hosting will keep getting get paid. Someone did donate $5. I will probably apply it to the hosting costs, or maybe just donate it to the animal shelter.

If you’re not wanting to donate or click ads, you could share the links elsewhere so that the site gains in popularity. Facebook, Twitter, Reddit, etc… There are even links at the top of each article that make sharing the articles even easier. 

More Meta – About The Community:

I often speak about appreciating the Linux community. It truly is special. 

The other day, I lost a near-and-dear to me online friend. They’re someone I had known for a long time. The older you get, the more you experience death (two in about a week). At least they went peacefully in their sleep. However, I felt a real loss and had real grief.

Anyhow, it reminds me of the Linux community. Pretty much every day, my online friend and I would exchange at least greetings. More often, we’d exchange a ton of messages in between our other activities. It’s amazing how much you can learn about someone this way. It’s also amazing how close you can become.

But, again, it reminds me of the Linux community. We often spend time with each other and develop true friendships. I mention this because I think it’s important to realize that there’s a real person behind each account. 

Yes, behind each account is a real person. They have hopes and dreams. All of them have accomplishments and faults. Yet they are dedicated to the same things we’re all dedicated to – making Linux more accessible and getting you up to speed with Linux.

So, while we’re celebrating holidays, let’s take a few minutes to thank those who give to the community. Let’s keep in mind that those people helping are real humans and appreciate their efforts. They put in hours and hours just trying to help a project they’re passionate about. Without them, we’d have no Linux. Without them, there would be no Linux community. They deserve our thanks and our kindness.

If you’re one of those people, we thank you. Thank you for the hours, thank you for the consistency, thank you for the passion, and thank you for your additions to said community.

You know who you are… Give yourself a hearty thanks and know that you’re appreciated.

Then again, if you’re on the outskirts of the community, it doesn’t take much to get involved. You don’t have to dedicate all your free time. Help where you can. Contribute what you can. But, most importantly, don’t be afraid to get involved.

More Meta:

I’d like to take a minute to point back to the first section and make sure you realize how much more this is than I expected. I never expected the site to grow this much. I never expected this much traffic, and I never expected the feedback.

Not so many of you comment here – but many of you comment elsewhere. That’s okay, as I know where to find you. It’d be just fine if more folks replied here to ensure future readers got the benefit of their wisdom, but that’s just fine.

I want to thank you for this. You made this as much as I did. Your encouragement, readership, and feedback are all motivations for me to continue. So, go back up to the first section and realize that those numbers are because of you. Without you, those would be meaningless numbers. To me, those numbers indicate value – and I appreciate it.

I never expected readership levels to be this high. Nor did I expect the site to be of value to so many people. While I did the writing, it’s you the visitor that has made it so. 

I’ll try to put it into perspective with just one image. This image isn’t what I’ve done, it’s what other people have done. This is just the search results from Google – but it’s a good example of growth:

Google search performance.
Those are just the Linux-Tips.us Google Search Performance numbers.

That’s right, there are now thousands of impressions and dozens of clicks every day. All I did was write the articles. Y’all are the ones providing the growth. The growth in traffic overall is rather amazing. I expected maybe a dozen daily users and used to be stoked when I had 20 visits per day!

I used to have to manually submit my new links to Google. These days, the habit remains but more often than not Google already added the new link to their index. For some reason Bing hates the site, but it is what it is and I can’t figure out why. Still, Google sends an excellent amount of daily traffic.

So, thank you my kind readers. Thank you very much. The site’s success is a great motivator to keep on going. My official ‘year’ will be ending in just a few more months, but it seems likely that the site will keep on going – simply because of the success it has had.

Closure:

Well, there’s another article. This one isn’t very technical, but it is important. Well, I (for one) think it’s important to thank people. It’s also a fine time to remind us all of the community behind this and a fine time to suggest folks have a happy holiday. (My birthday is coming up in a few days, but there should be articles aplenty.)

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 About Absolute And Relative Paths

In your Linux journey, you’ll use both absolute and relative paths. It’s important to know the difference and, perhaps, when you want to use absolute paths or when you want to use relative paths. It’s a pretty easy lesson and not a terribly long article.

First, paths are directory names and links to files. They’re always unique names to files and folders. They’re useful for referencing things, knowing where things are, organization, and the likes. To manage a file, you should probably know where it is.

An example of an absolute path would be something like:
/home/<user>/.bash_profile

An example of a relative path would be something like:
~/.bash_aliases

An absolute path will always begin with a /, for example. As they’re the easiest, let’s cover them first:

Absolute Paths:

Let’s say you have a file in your Documents directory and it is named foo.txt. If you wanted to read that file, you could navigate to the Documents directory and use cat foo.txt to read the file. 

That’s only going to work when you’re already in the Documents directory. If you’re not in the proper directory, you’ll have to use the absolute path. That would look like cat /home/<user>/Documents/foo.txt and that would work. 

As I said already, absolute paths have to start with a /. They’ll also start with one of the root directories, such as /etc, /bin, or /media. You can see those directories in your file manager by going up a level until you can go no further, when you’re at the absolute / directory.

An absolute path works even if you’re working in a different folder in the terminal. When you’re in /home/<user>Pictures, cat /home/<user>/Documents/foo.txt will still work just fine. 

Again, they’re a unique identifier for a directory or a file. If you wanted to change the directory in the terminal, you could use cd /home/<user>/Pictures. That would work just fine.

Relative Paths:

Relative paths are paths based on where you are already. They’re based on your “PWD” or Present Working Directory. There’s a few ways that these can be used. Conversely, a relative path never begins with a /.

For example, if you’re already in /home/<user> then you can cd Documents to get to your Documents directory. As you can see, that’s much easier to type.

Of course, there’s the tilde – which already means /home/<user>. So while possibly not the same thing you’re thinking of when you think of relative paths, you can also get to the Documents directory with cd ~/Documents.

If you’ve used the ‘ls‘ command before, you may have noticed a . and a .. in there. Well, the . stands for your current directory (and some commands will want that) and the .. stands for the next highest directory.

Assuming you were in the Documents folder, you could do cat foo.txt you could also do cat ./foo.txt and get the same results.

While in the Documents directory, you could cd . and that’d take you exactly nowhere. More useful, you can cd .. and you’d be back in /home/<user>. If you did cd ../.. you’d end up in the /home directory.

You can also (though I have no idea why you’d want to) use the above mentioned $PWD environment variable, but I never do and I don’t see much of a reason why you’d want to. Assuming you were in /home/<user> you could, again if you wanted, use cd $PWD/Documents and happily reach the Documents directory just fine.

Absolute and Relative Paths:

As you can see, there are different times and places to use a relative and an absolute path. When in doubt, I prefer the absolute path. If I’m writing notes that may apply differently to different systems, I’m more likely to use the absolute path. When I’m in a hurry, I tend to use a relative path – when I can use one.

You might as well get used to using both of them. They both have a right time and place. Commands like chmod may want an absolute path or will want the directory included. So, you’ll possibly need to chmod +x ./foo.txt instead of chmod +x foo.txt. In time, you’ll adjust and know which suits your needs best.

By the way, if the tab autocomplete doesn’t work after the command, the command probably demands that you denote the current directory with the . indicator like in the chmod above. If you type chmod +x fo<tab> it will refuse to autocomplete the filename. Once again, in time you’ll learn when that’s needed.

Learning to use Linux is a journey, not a destination!

Closure:

And there you have it! You have yet another article said and done. This one isn’t like some of my normal articles, but it’s still information folks might want to know. I find as the site grows, it gets possible to reference earlier articles, which is quite nice.

There are some articles I simply can’t write until I’ve taken the time to write other articles. I kinda like that. I’ve been enjoying typing these things out. I find the better I can explain them, the better I understand them. Heck, I recommend y’all make your own sites as this is pretty darned informative for me. The feedback is awesome and helps me understand even more.

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.