Let’s Have Some Fun With Cowsay And Fortune

Today, we’ll be having fun with ‘cowsay’ and doing so while getting your fortune in your terminal. Why not? Linux doesn’t always have to be about work. Today’s article will be not even remotely useful for work and none of what you learn will greatly increase your Linux skills. We are doing this for fun, mostly.

Sometimes, it’s okay to be a little silly and to have some fun.

Besides, you’ll get to use the | (pipe) and that’s always fun! Seriously, the pipe is one of the best tools Linux has. It lets you take the output from one command and use it in another one. The man page helpfully describes it like this:

pipe – Postfix delivery to external command

We’ll just be scratching the surface with pipe, so be sure to run man pipe if you’re unfamiliar with it. Pipe hails from Unix and has been with us, in one form or another, since 1973. I dare say that the longevity is good evidence of the value.

I’m just going to give the directions for Debian/Ubuntu/derivatives. I haven’t checked across all the systems, so I’m not sure what distros this will work on. Probably all of the major distros, but it should work on anything with Debian in its lineage. If you’re not doing so, you should still be able to follow along and just adapt it to your package management systems. 

So, that being said and done, let’s look into this matter of a mad world with cows and fortunes.

Fun With Cowsay:

The first thing we have to do is open a terminal. Press CTRL + ALT + T on your keyboard and the default terminal emulator should open up. Once open, run the following command:

That should install both ‘cowsay‘ and ‘fortune‘, along with any dependencies that need to be satisfied. Those are the only two tools you need to install for this exercise, or at least they should be.

Fortune:

Fortune is a tool that outputs fortunes from a database. A normal use would be:

That should happily output a fortune for you.

Cowsay:

The cowsay application prints a graphic that looks vaguely cow-like and any text you tell it to print. The command would look a bit like this:

All of which is all well and good – but the magic is when you put them together. So, let’s try that. Let’s pipe fortune output to the cowsay application:

Which will have an output similar to this:

cowsay in action
See? You’ve got a cow spouting wisdom in the terminal! Just what you always wanted!

That’s not it! No, dear reader, that is not it! That’s not all you can do! See, you can change the cow to Tux, the Linux penguin mascot.

What the penguin has to do with a cow, I know not. But, I do know that you can use the command and output a penguin. 

The output from that command should look pretty similar to this:

cowsay goes tux
See? It’s Tux! I wouldn’t make this sort of stuff up. It’s too important!

And there you have it. You’ve successfully piped the output from fortune to cowsay and, as a bonus, morphed the cow into tux. Another productive day at the office, while having fun with cowsay!

Closure:

I’ve got a couple of articles ahead, which is nice. This one tells you how to have fun with cowsay, which is also nice. It’s pretty important business!

Now to write some that are scheduled years in the future (so that I don’t mistakenly post them and they’re out of the way) and not fret too much when Mother Nature comes to claim my internet… I’m not giving up on my publishing schedule yet!

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: List All Users In Linux

If you want to list all users in Linux, this is the article for you. It should be a fairly short article, but it should tell you how to list all users. So, there’s that. By that, I mean it’ll probably do what it says on the tin, namely telling you how to list all your users.

You may want to check the list of users from time to time. Applications may add users, you may have added users, malicious software or people may have added users, etc… There are other reasons to list all users, but you get the idea.

This is a beginner-level exercise, so you shouldn’t have any difficulty with it. It should also be reasonably short, which is nice! If you find any mistakes or have any questions, scroll down and leave a comment. You can also ask on the lovely Linux.org forums.

Without further ado…

List All Users:

Once again, we start with opening the terminal. To do this, you just press CTRL + ALT + T and the terminal should open. That’s true on most distros that I’ve encountered. If not, you will still need an open terminal.

Got it open? Good, ’cause it’s a pretty easy operation. The file you’re looking for is ‘/etc/passwd’, which is a plain text file that’s in conjunction with the /etc/shadow file. Like most text files, it’s easy enough to work with them in the terminal.

You probably shouldn’t edit /etc/passwd by hand, but we’re just going to be viewing it.

So, to show the content of the file (and see the list of users):

If you want to show fewer results at a time, you can just use:

If you want, you can ‘grep’ a specific user. Just pipe the output to grep and you’re good to go. It looks like this:

If you want to use that format AND have numbered lines, one way of finding out how many users there are, then just use:

Though you could just as easily have used this to get the number:

If you want to list just the users, you can use ‘awk’ and pick the first column like this:

And that’s about it, really. You’ve now listed all the users – and counted ’em!

Closure:

That’s it! That’s all there is to it, and you’ve learned a little bit more – this time how to list users in Linux. I told you that it’d be pretty painless and easy. Plus, this is another article for the books – and this one authored early enough to give me some time to keep scheduling them ahead of 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.

How To: Install The Regular “non-Snap” Version of Chrome Browser In Ubuntu

Install Chrome browser on Ubuntu…

This article was authored while I was sick and pukin’. Well, I’d mostly stopped puking while writing.. Thanks to a fantastic @GGG_246 from Reddit (No thanks to you folks on Linux.org who normally catch this stuff!) the entire intro was meant for Chromium and not Chrome.

This is because I was moving it from the old site to the new one, splitting it into two articles. The old article covered both Chrome and Chromium. Also, I was sicker than I’m gonna describe…

So, here you go… This is how to install Chrome browser on Ubuntu. (I am still not quite back to normal. Ask me about my bowels!)

Install Chrome Browser:

Let’s just jump right into it. You know what Chrome Browser is, or you wouldn’t be here. It’s also not very complicated. Let’s bust open your default terminal emulator by pressing CTRL + ALT + T and enter the following:

That’s it in the terminal. You’re done. When you finish the installation and start Chrome it will let you set it as the default in the terminal or GUI (if you want), among other things. Even better, the installation adds its own repository and will now automatically update the Chrome browser when the rest of the system is updated.

chrome repository

The repository contains the beta version as well, as well as the unstable version. With the repository added, you can install any of them easily. Be aware that beta may have bugs and that unstable is a nightly build that’s also prone to bugs. Using either means you understand the risks – and also kinda comes with the responsibility of reporting bugs.

google chrome other versions
Just use ‘apt install’ and they’re there for the taking. Install as you wish!

And, that’s about it really. There’s not a whole lot to this article and it’s intentionally short. I’ll do a very similar article about Chromium, so be prepared for that!

Closure:

One more article is in the books. This one is short for a couple of reasons. One of those reasons is that I’m not feeling well. That and power outages make me wonder if I’ll actually manage to do this for the full year. I should get a bunch of articles ahead! I’m eventually going to miss an article or two and I should probably prepare for that.

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.

Use Sublime Text On Ubuntu (And Derivatives)

Sublime Text is a proprietary, closed-source, paid application with a free version that has most of the paid features. It’s a pretty solid text editor and it’s worth taking a look at it.

I covered my favorite text editors and Sublime Text got a mention, even though it isn’t in my top 3. It’s actually a very capable text editor, it’s just not in my top 3 list. I don’t have to be the target audience to recognize its potential! It’s great to expose folks to the application. Choice is a good thing and it could be in your top 3 list.

It has a great ‘find in files’ feature that works well and I’ll sometimes start the application just for that. Being able to find (and replace) text across multiple files in a graphical way is pretty great. They’re not alone in that feature, it just works well in Sublime.

In fact, Sublime Text has a tagline that reads:

Text Editing, Done Right

And, they’re not wrong. There are all sorts of ways to be right, as there are as many preferences for text editors as there are text editor users. Here, they’ve been making and selling Sublime Text for 13+ years and have loaded the application up with a ton of features.

And, indeed, there are a lot of features – from multi-tab select, to ‘context-aware’ autocomplete, to GPU rendering, to macros, projects, and more. It’s definitely aimed at programmers who work with large amounts of text.

While I could try to enumerate the many features and benefits, you can just try them for yourself. It’s a time-limited trial, but the application keeps working beyond the trial date. You can continue using it, or you can pay for it.

Install Sublime Text:

When installing Sublime Text in the past, I’ve come across convoluted methods to install it. The reality is that it’s just three (maybe four) commands. You don’t need to install a bunch of prerequisites. There’s no need to install other things to get it to work, it’s a fairly normal installation.

Note: This installs the ‘free trial’ version. It works wonderfully. At the end of the free trial, it’ll happily continue to work with most features still intact. There’s no ‘need’ to pay for the software. However, many people have found it useful enough to pay for it.

Let’s press CTRL + ALT + T to open the terminal and get Sublime Text installed! Remember, if you don’t like it, you can just as easily remove it.

If it’s not obvious, copy each line, paste it into the terminal, press ENTER, and make sure to pay attention to any outputs so that you can act on them. I don’t anticipate any trouble, but you can leave a comment if need help. You can also ask at (I’m a moderator) Linux.org if you get stuck.

Properly installed, it’ll look a little something like this:

sublime text finding text in files
Sublime Text being used to find a phrase in multiple files. It’s a great feature.

You may not need to run the sudo apt update from above. The system may automatically update the database after the repository is added. The other commands are probably all you need. It’s nothing convoluted and it “Just Works!®” Well, it just worked with a few local tests. It’s also worth installing this way to make sure that that Sublime Text gets updated with the rest of the system.

Closure:

And that’s it. Open Sublime Text from the GUI menu, probably entered under “Programming.” If you want to see the text information in your terminal that you already have open, it’s called ‘subl’. So, try subl -h to see what command line options you have. 

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.

Weather In The Terminal? We can do that!

Weather in the terminal? There are people who pretty much live in the terminal! They do everything there, including checking the weather! This article will show you how to get your local forecast in your terminal, because why not?

Where I live, they have a saying, “If you don’t like the weather, wait a minute.” The weather is constantly changing and is responsible for killing quite a few people every year. We have some pretty extreme weather. Because of this, I pay fairly close attention to it – but, really, I don’t tend to check it in the terminal. I use a more robust solution. This article is for those folks who want to. You’re welcome!

First, a little poem:

Whether the weather be fine, or whether the weather be not,
Whether the weather be cold, or whether the weather be hot,
We’ll weather the weather, whatever the weather,
Whether we like it or not.  — anonymous

See? Who says we’re uncultured here?

Anyhow, this is just going to be a pretty brief article. It’s pretty simple to check and it requires just your terminal and a tool called ‘cURL‘ (which has been covered already, so click that link to save some time). If it turns out to be something you like, you can always alias it for regular use or just commit the short commands to memory.

Weather In The Terminal:

Seeing as this is ‘weather in the terminal’ we should probably start with opening the terminal! That’s easy enough, just press CTRL + ALT + T and your default terminal will open.

Once you have it open, you’ll be using a website known as WTTR.IN. You can actually just click that link and get the weather in your browser. It should be your local-ish weather, unless you’re using a VPN. The site is using IP Address Geolocation to show your local weather and a VPN presents a different IP address, meaning it may not actually be your local weather. The same is obviously true in the terminal.

Start with just a basic example, try:

That should be ‘close enough’, depending on where you live and how accurate the geolocation is. If it’s not, you can add some information – such as town and state (or province, or whatever your country uses). It’d look something like:

The output from that command would look a little something like this:

weather forecast in the terminal
See? It even knows I’m in the USA, so it uses the correct units. Neat, huh?

You can even use some landmarks and it will try to figure it out. For instance, you can check the output from this command:

If you’re in the US, then it will show you the results in our goofy units – even if metric is used at the location. Well, it will try to – within the limitations of geolocation. If you want to change it up, you use a ‘u’ or an ‘m’. To force the above with metric units, you enter:

Anyhow, there’s so much more that you can do. Frankly, the above are all I really use it for – and I seldom bother with that. Living where I do, I get my weather in a browser and with a browser extension. So, be sure to use the following to learn more:

You can also just visit https://wttr.in/:help to get that same information in your browser. It’s up to you, but you’re already in the terminal so you might as well keep using it!

Additional info: GitHub repo is located here.

Closure:

And there you have it. Another article is in the books, this one showing you how to use your terminal to check the forecast and current conditions. There are a ton of options that I didn’t bother covering, but options that you may find useful. Be sure to check the help page and keep up with the project on GitHub.

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.