Linux tutorial, part 2

Quick Start: A typical login session

In my previous post I talked about the history of the Unix and Linux operating systems to give you a little background for the rest of this lesson.

Next, I'd like to dig in and show you what a typical Unix login session looks like, and then I'll get into more details after that.

To begin with, a typical session for me involves opening up a Terminal window on a Mac OS X system. If I don't have one open already I'll open it by clicking on the Terminal icon in the Dock. I've customized my system a little bit, so my terminal window opens with a black background and green text, and a prompt that looks like this:

/Users/al> _

Let's assume that I just finished editing a new web page that I want to copy to a remote system named "foo.bar.com".I'll show you how I normally copy it into the "/tmp" directory on this remote system.

Moving around and listing files

On my local system I have the new file in a directory named WorkingStuff, which is directly underneath my home directory, so I first move to that directory:

cd WorkingStuff

Next, I check to make sure the file is here, using the ls command with the -l option (that's an "ell", not a "one"), to see how big the file is:

ls -l foo.html

The system responds with output like this:

-rw-r--r--     1 al    al     9602 Jan  1  2007 foo.html

This long listing confirms both that the file is here, and is in fact 9,602 bytes in size. If the file was not here I would have seen an error message like this:

ls: foo.html: No such file or directory

Copying a file to a remote system

I want to get this file to my remote system, and I can do that either using ftp, which isn't secure, or scp ("secure copy"), which is (it encrypts the transmission). Personally, I always use scp. I copy the file foo.html from my local system to the "/tmp" directory of a remote system named foo.bar.com using this command:

scp foo.html al@foo.bar.com:/tmp

This also assumes that a user account named "al" exists on the remote system. After a few moments the remote system prompts me for the password for the "al" account. Most Unix systems don't show anything as you type your password, so I just type my password for that system, and when I type it correctly it begins the transfer, and shows some nice transfer stats on the terminal. When it's complete I'm returned to my command line prompt.

Now that the file has been transferred to that remote system I need to login to that system to I can move it to the right place, and edit it if need be. I'll show you how to do that in my next post.

Go on to part 3 >