Absolute Beginners: Unix for Art Students – Part 2

You see a Macintosh OS X 10.6 desktop with the standard background, purple spacescape, the sole program open is the terminal program, showing an ascii art that reads: “Absolute beginners”.

If I type

$ figlet absolute beginners

into my terminal, this is what I get:

       _               _       _       
  __ _| |__  ___  ___ | |_   _| |_ ___ 
 / _` | '_ \/ __|/ _ \| | | | | __/ _ \
| (_| | |_) \__ \ (_) | | |_| | ||  __/
 \__,_|_.__/|___/\___/|_|\__,_|\__\___|
                                       
 _                _                           
| |__   ___  __ _(_)_ __  _ __   ___ _ __ ___ 
| '_ \ / _ \/ _` | | '_ \| '_ \ / _ \ '__/ __|
| |_) |  __/ (_| | | | | | | | |  __/ |  \__ \
|_.__/ \___|\__, |_|_| |_|_| |_|\___|_|  |___/
            |___/                             

Figlet has proved to be a gateway drug for extended terminal usage. Figlet is not on your computer by default though. Even though your mac comes with a lot of unix software already, not a lot of it is graphics software. To install new software you need to install what is called a package manager, as explained in I like tight pants and installing compilers. This article will continue with an introduction that tells you how to use the terminal!

In your Applications folder, choose Accessories, and open Terminal. Now you can talk with your computer. He can tell you who you are. Type:

$ whoami

(without the $ and the space, that’s just a convention to denote text that you enter into the terminal). And press enter. The computer outputs your username! The computer also knows where you are, at least where you are on the hard disk. Enter:

$ pwd

And the computer will repond with /Users/yourusername. It would make sense if you could say whereami but consistency is not Unix greatest strength. You are now in what is called your home folder.
You can always return to your home folder by typing:

$ cd

cd is also the commando to use to go to another folder. You can use the tab button to make this go quicker.
Type, by example:

$ cd Do(tab)

You will see

Documents/ Downloads/

Complete further to

$ cd Doc(tab)

And your line will be extended to form:

$ cd Documents/

When you push enter, you will arrive into the folder Documents. You can check this by again typing

$ pwd

To see what files are part of the folder you are in:

$ ls

You can also check this in the finder, if you want. You can use the terminal and the finder at the same time. This can make it easier to learn what is going on. You can launch the finder from the terminal.

$ open .

. refers to the current folder. open . will open the current folder with the associated program, which is the finder.

To make a new empty file:

$ touch my_text_file.txt

If you still have the Finder open, you will see it appear! To open with the text editor:

$ open my_text_file.txt

These are the basics of navigating around the terminal.

2 Comments

To continue in this vain, starting from scratch, a really useful resource is The Command Line Crash Course — Controlling Your Computer From The Terminal by Zed Shaw. From there, it’s just practice really. Baseline takes the terminal to a practical application in I like tight pants and absolute beginners: unix for art students – part 3, and throughout this blog you will find scripts you can use from the terminal.

By the way, those students trying this out on Windows, through Cygwin, There is nothing in your home folder initially. That is because Cygwin makes its own version of the unix file system on your hard disk, contained within the cygwin folder. So while in cygwin your home directery appears as /home/tellyou/ for example, it is not the same home as your Windows home directory. The actual location of the cygwin home folder on your hard drive will then be c:\cygwin\home\tellyou\. So while you can do ls in you home folder, you will see nothing (as there are no files) and you won’t be able to cd anywhere. Also the open command is unique to Mac OS X and does not exist in other Unix flavours. The touch command does work as expected. So you can touch a new file, and then open through the explorer. To install new software on Cygwin, you need to rerun the Cygwin setup.exe you downloaded to install Cygwin initially. You can then select additional packages to install alongside. Use the searchbar to quickly find figlet, for example.

Reply

Leave a comment