MacMost Now 613: Fun With the Terminal

There are some odd and unusual things on your Mac that you can do with the Terminal. You can create banners, use your screen saver as your desktop background, look at interesting, daily calendars, and play hidden games.

Video Transcript
Hi, this is Gary with MacMost Now. On today's episode, let's look at some fun things you can do with the terminal. Now there are a lot of strange and unusual things hidden on your Mac that are only available through the Terminal. To run the Terminal program, you can find that in the applications utilities folder, or in launch pad and line. It's in the utilities folder there. So you run Terminal, and then you can type a command. For instance, here's a simple one called banner. You type banner, space, and then some text. Let's put some quotes around it, and put "Hello World.", period. And the result is, is I get this string of characters like that. And actually spells out Hello World in very large text. Now I can actually put that in a file, make it easier to see. So let me do PWD, which is the, uh, gives me the path where I'm at. So I say I'm at users MacMost. Let me go down into documents. CD change directory down into documents. So, you see, I'm in the documents folder now. Now let me do banner, and do that hello world again. But, I'm going to put it in a new file called banner.txt. Like that, with the greater than symbol, and then the name of the file. Now, if I were to open up a new finder window, I can see that, here in my documents folder, I've got banner.txt. And I can open that, and I can see it's in there. Let me select it all, and command minus 2, shrink the font size. And I can see exactly what it is I've got. And any time you want to find more Mac commands *, you can use the manual command, MAN, man, and type the name of the command. So I do that for Banner, I'll actually get some detail here. I can hit return, or space bar to go through it. And see that there's some things, like, uh, the output width, uh, things like that. So with any of these commands, when you spend anything in the terminal*, use MAN to find out more. Now, you have a bunch of unusual calendars, or list of dates, uh, hidden on your Mac. To find them, go to the directory usr/share/calendar. And then ls will list the files there. And you can see all these calendar, dot, something. Now, a lot of people will talk about just one or two of these. But here, you can see them all. So, for instance, if you wanted to do, uh. You wanted to see what was in the, we can do cat, which will output everything to, uh, the terminal window here. And you can do And you can see here, I got this list of days of the year, and something that happened on those days. Uh, you can see there's all sorts of calendars like that, including this one here, which gives you Lord of the Rings, uh, important dates. Kind of interesting there. And you have holidays, and all sorts of other things that you can poke into. You also have the cal command, which gives you this little calendar of the current month. It's plain text, so you could actually copy and paste this into something if you liked. Uh, you can modify it. Again, you look at, use the man command to see all the possibilities. Uh, and we can try things, like, for instance, cal, and then let's look at December of this year. Or cal, and we can look at, uh, an entire year, like that. Now, there's a text editor inside of Terminal. Actually, there's a whole bunch of them, but one of the most powerful ones is emas. Now, emas is so powerful, it has a scripting language. And some people have written games that work inside of emacs.So to find out what games you have, here's what you want to do. You want to go to this folder, usr/share/emacs. And then you wanna list what's there. And you'll get one that shows a version number, in this case, iversion 22.1 of emacs. It may be different on yours, and it may be different if you're watching this video far in the future. I'm gonna go into that directory, in this case, 22.1. And then, inside of there, uh, I'll be able to go into lisp/play. And then ls, list the files in there. And I get a whole bunch of different game files, most of which will work for games. So, for instance, I see that there's Tetris there. So, let's go in and run emacs like that. Now I'm in the emacs editor. I'm going to hit escape, and then x. And then type the name of the game. And there I go. Now I'm playing Tetris, I can use the arrow keys to move around. To switch to another game, I would do escape, x, and then type in the name of the new game. And I get to play that. To quite out of emacs, uh, you would do control, x, and then control, c. Here's another game you can play. You can get it by typing emacs-batch-l dunnet. And you get to play a version of an early
text based adventure game. Now, let's look at some other weird files that are on your Mac. Uh, if you go to the directory, usr/share/misc, and you look, there'll be some weird things in here. Like, for instance, see the one called flowers? Let's take a look at that. You can see it gives you definitions for different flower types. So, kind of an odd bunch of text files here. Okay, now here's a very long and unusual command. I'm going to paste it in here. Uh, and you can try to type it in if you want. System/library/framework/screensaver.framework/Resources/ OS/ScreenSaverEngine -background. So, what does all this do? Well, it will take the current screen saver you have selected, and throw it on as your desktop background. So if I move here, I can see there. My desktop background is actually the screen saver. Now, this is a program that's running in Terminal. Uh, you can see, I've got a bunch of error messages there. I can just ignore. But it's running, I can't actually, I can't actually type anything else here. Um, nothing else is going on. Uh, I have to do control,c, to break out of it, and it stops running. So, you can kinda keep that going on in the background, it's kind of a special effect. Uh, maybe while you're doing a presentation or something like that, or just for fun. So here's something interesting you can do. You can create a mini-internet that is your Mac, the files on your Mac. So the first thing you wanna do in Terminal is go to where you want to start. So for instance, let's go to users/MacMost. And I can see where I am now, so I'm, I'm in my home folder. And then I'm gonna run this simple command here. It's a python command, um, and you can see it here. Python-m SimpleHTTPServer. I'm gonna run it, now I'm running the Simple Server. I can bring up a window here. Here's a safari window. I can go to localhost:8000, which is the port it's gonna run on. And I can see all the files there. There's my document folder. I can dig down in my documents folder, and see the stuff there, just like I'm looking in the finder. And I can go back, and I can even download files, do things like that. So there's some fun things you can do with the Terminal. Most of the time, when people talk about the Terminal, they're just talking about these little one line commands, where you change a default, so a setting changes in an application. But these are thing that you actually can do in the Terminal. So, I hope you found it interesting. Until next time, this is Gary at MacMost Now.

Comments: 12 Responses to “MacMost Now 613: Fun With the Terminal”

    Dr. Mikey
    10/3/11 @ 3:18 pm

    Great stuff as always, Gary! Is there a way to import those calendars into iCal?

      10/3/11 @ 3:26 pm

      No, I don’t believe so. But maybe someone has made the particular one you want into iCal format — I’d search for it online.

    Dr. Mikey
    10/3/11 @ 3:30 pm

    Wow, thanks for the quick reply! Makes one wonder why some of those things are there if they can only be found by geniuses (like Gary!) using the Terminal…

    10/5/11 @ 6:38 pm

    Wow Gary that was great!
    So cool. I always learn neat and useful things from you.
    Keep up the super tips!

    10/6/11 @ 12:50 pm

    A fun one (if you’re in the right frame of mind) is “say [fill in blank]”.

    Lance R
    10/6/11 @ 4:57 pm


    This is definitely one of the most, if not the geekiest video you have published. While I enjoyed it, I couldn’t help but chuckle that what you are talking about, the behind the scenes stuff in the unix backbone of the Mac OS. I’m surprised you didn’t start talking about the cron and other unix services.

    The beauty of the mac is the lack of need to go the backdoor route to solve issues. This was a fun look at the insides of my mac. Thanks for going where most people will not, unless forced to.

    Bob Sander-Cederlof
    10/7/11 @ 8:23 am

    When I type python -m SimpleHttpServer in the terminal, the response is
    /usr/bin/python: No module named SimpleHttpServer
    (I am running Snow Leopard, 10.6.8)

      10/7/11 @ 8:26 am

      The command is:
      python -m SimpleHTTPServer
      (letter case is important)

        Bob Sander-Cederlof
        10/7/11 @ 12:38 pm

        Thanks Gary!
        (I had copied it from your video transcript, there it had Http.)

    Bob Sander-Cederlof
    10/7/11 @ 8:30 am

    But “python -m SimpleHTTPServer 8000” works.
    Apparently I need to type the port number as part of the command to make it work.

      Bob Sander-Cederlof
      10/7/11 @ 12:40 pm

      As Gary pointed out, letter case is important. I don’t need the 8000, because that is the default. But I do need SimpleHTTPServer rather than SimpleHttpServer

Comments Closed.