Value Added | daily

Class Schedule

Basics | sessions 01-03
  1. 19 Jan intro and clients | lecture | labs
  2. 26 Jan servers and command line | lecture | labs
  3. 02 Feb networks and protocols | lecture | labs
Web Development | sessions 04-08

  1. 09 Feb structural layer | lecture | labs
  2. 16 Feb presentational layer | lecture | labs
  3. 23 Feb using a structure | lecture | labs
  4. 02 Mar behavioral layer | lecture | labs
  5. 09 Mar design thoughts | lecture | labs
Dealing with Markup | sessions 09-10
  1. 16 Mar control objects and display | lecture | labs
  2. 23 Mar tools that read markup | lecture | labs
Working with data | sessions 11-14
  1. 30 Mar formulas, functions, vectors | lecture | labs
  2. 06 Apr data display | lecture | labs
  3. 13 Apr manipulate data sets | lecture | labs
  4. 20 Apr relational data bases | lecture | labs
Presentations | sessions 15-16
  1. 27 Apr designing a presentation | lecture | labs
  2. 04 May delivering a presentation | lecture | labs


Normally, one can work within the Shell of the server operating system
by using a command line interface.

Q: Are we really using UNIX?

A: We don't know.

Servers may be using either UNIX or LINUX, but the commands for both operating systems are essentially the same. So, if we learn the commands and behaviors for one, we probably can work easily on the other as well. For the rest of this page, where the word UNIX is used, you can substitute LINUX as well.

UNIX/LINUX using a terminal connection

You are about to learn enough UNIX commands to be dangerous to yourself and others.

A little knowledge is a dangerous thing. This is especially true of UNIX. In UNIX it is possible to erase every one of your files with one little command and never get an "Are you sure?" message or warning.

Ask me.
I've done it.
And while I've done it to my own files, some network managers have done it to every user's files.

back to top

Whether using Mac or Windows, connecting with Terminal is somewhat similar.

To login, you need to make a terminal connection to the Opal server.

For Macintosh machines, you will be using an SSH client that comes with every Apple computer (although you might not have known about it).

SSH uses ssh (the Secure Shell) to login, so that your username and password are not visible to other people on the campus network.

To login from your Internet-connected computer wherever it is

If you use a Mac
  1. Start the Terminal program (go to your Applications folder, click Utilities, and select Terminal)
  2. A new window will pop up. It will appear blank for a few seconds; wait until a prompt appears, ending in a % sign.
  3. Type <ssh your_onyen@opal.ils.unc.edu> where your_onyen is your Onyen; hit Enter.
  4. You will be prompted for a password. Enter your Onyen password, but note that as you type it will look as if nothing is happening. Don't worry--just keep typing and press Enter again.
Connect to Remote Host dialog box through Terminal
  1. Wait for a few seconds. When you see a prompt ending in $ you are in.
If you use a Windows system
  1. right click on the start icon, or, easier yet, just use your search tool to find it and open it.
    how to find powershell
  2. A new window will pop up. It will appear blank for a few seconds; wait until a prompt appears, ending in a % sign.
  3. Type <ssh your_onyen@opal.ils.unc.edu> where your_onyen is your Onyen; hit Enter.
  4. You will be prompted for a password. Enter your Onyen password, but note that as you type it will look as if nothing is happening. Don't worry--just keep typing and press Enter again.
Connect to Remote Host dialog box through PowerShell Terminal
  1. Wait for a few seconds. When you see a prompt ending in $ you are in.
  1. Once there, you are in a shell session and thus into UNIX. The $ is the UNIX prompt. The bash $ may be a Linux prompt. But both will do the same things.
schematic of how UNIX works like a bullseye with the Kernel at the center, surrounded by the Shell, 
								which is surrounded by the Applications

back to top

First things first

Before you (or anyone else) can view your files in a web browser, you must change the access permissions for your home directory on opal. If these permissions are set incorrectly, anyone trying to view your webpage will see a Forbidden error rather than your content. Follow these instructions to set the correct permissions:

  1. Open an SSH connection to Opal or Ruby respectively. On Windows, you'll need to use an SSH client for this; on MacOS and Linux, you can open a Terminal window, enter "ssh your_onyen"at"opal.ils.unc.edu" (without quotes) and then enter your password when prompted.

    Once you've connected, you should see a command prompt like this: [your_onyen"at"opal ~] $
  2. Type chmod 711 . with both the space and the period and press Enter. If you get a "missing operand" error, make sure you included the space and the period at the end.

See more about this on the SILS ITS help page.

Now, we are ready to work at the command level

back to top

What does this mean? Where exactly are we? Are there any clues?

We are in our "home" directory.

  1. In UNIX file system parlance there are directories similar to the "folders" that you may be used to using on Mac or Windows systems.
  2. These directories exist in a hierarchical structure where your "home" directory is the "root" or top level of your files and directories.

Some general tips on logging into and working on remote computers

  1. Your mouse won't do much. You can't click things to make them happen.
  2. You can, however, copy and paste between applications.
  3. You can scroll up and down in your SSH window to see what you did previously.
  4. You can switch between your login window and other windows, or set them up so you can see multiple windows. This is very useful when editing a Web page while logged in, and viewing it in a Web browser in another window.

back to top

Working within UNIX

We will work from the UNIX command line [the $].

This would be a good time to get used to a convention.

commandsargumentvalue

Working with Unix/Linux at the command line requires us to know certain exact commands.

But we also want to become comfortable with the fact that some commands require an argument to effectively carry out the command.

For example, chmod 711 .

back to top

Some commands require an argument to effectively carry out the command

back to top

Sometimes the argument will include a specific value that must be appended to the argument in order to carry out the command.

back to top

Sometimes the argument will include a specific value that must be appended to the argument to effectively carry out the Command

back to top

We will have to get used to this syntax as it will be a common theme in all the tools we will encounter.

If you want reference sheet for Unix/Linux commands, you may use and save this one.

back to top

Do some navigating

As you move around among your files and directories, you may become disoriented as to "where" you are. UNIX has the concept of "current" directory, also known as the working directory, or the directory you are currently "in". Two additional commands will be useful to determine what directory you are in.

to find yourself, use the

pwd - the print working directory command
pwd doesn't take any arguments

to move between directories, use the

cd - the change directory command
cd takes the destination directory as its single argument.

Try this: cd public_html then ls or pwd

Do you see that you changed to a new directory?

Type cd to return home.

More on ls (that's "ell ess"):

ls -l gives a long directory listing, including the file size, creation date, and access permissions

ls -s gives the size (in blocks) of a file

ls -a shows all files.

Otherwise, files starting with a dot (.) are skipped.
Your current directory is always abbreviated as .,
and the parent directory is always abbreviated as ..

You can put more than one argument on the ls command, as in ls -als

rm is forever! Be careful with it.

back to top

Create directories and files

The next step is to create some directories and files in your home directory.

There are several commands that you will use to create directories and files.

  • mkdir make directory
  • rmdir remove directory
  • mv move file
  • rm remove file

These are (again) command line commands. They all have options, and they all take one or more arguments. In UNIX parlance, an argument is a file or directory name, or some other piece of information needed to complete the command.

To step up one level from a directory, you want to use the command ../
This tells the server to step up to the parent directory.

We will look at the arguments.

To create a directory,

type the make directory command mkdir followed by the name you want the directory to have. This looks like:
mkdir mynewdir
In this case, mynewdir is the argument for the mkdir command.

Removing a directory is similar

the argument is the name of the directory you want to remove. Try it.
rm for removing a file takes one argument, the name of the file.

The Copy cp and Move mv commands

each take two arguments.
In the copy command, the first argument is the name of the file you wish to move or copy, the second argument is the name of the file you want to copy into or move the file to.

cp mynewfile mynewfile1 makes a copy of the file named mynewfile and names it mynewfile1
The move command is essentially a rename command.

The arguments are not limited to file and directory names in the local directory. An argument can specify another directory and a file in that directory. For instance, if you have a directory called public_html (which you should), then you can move a file from your home directory into this directory as follows.

mv thisfile public_html/

If in addition to moving the file, you want to rename it, then the new file name can be typed following the slash, as follows:
mv thisfile public_html/thatfile

back to top

UNIX file literacy

These are commands commonly used. You will find them valuable when you work within a UNIX system, and for other UNIX tasks as well. Remember: UNIX is case-sensitive

Commands can have arguments and options. Options usually have a hyphen.

Most common errors in UNIX come from not knowing what directory you are in. Use the pwd and ls commands to keep track.

Use the man command to get usage information

back to top