UNIX is an Operating System, which is the program (software) that makes a computer run. At this point, all you need to know about UNIX is that it's there working for you and that it's able to execute your commands.
To get a UNIX account means that
Let's first talk about the space (quota) that you get. Your space is used to store files. Files can be programs, email letters, scientific data, etc. To organize your files, there are entities called directories. Directories are "folders" that you can place your files into. You can also put directories into directories.
All of your files and directories will be inside your home directory, which has the same name as your account. In fact, your files and directories are structured like a family tree.
Figure 1.
In this tree, the children of a directory are its contents -- files and other directories. For example, the home directory (Directory A) has four children: File A, and Directories B, C, and D.
Now let's talk about the kinds of commands that you can execute in UNIX. The following are some of the kinds of commands available:
There are a number of places you can access wiliki.
Methods for accessing wiliki may vary slightly depending on where you are and what type of computer/terminal you are using, but generally, it will be done using program called ssh, which is Secure Shell Client. To log into wiliki from another UNIX (or LINUX) computer, enter:
ssh wiliki.eng.hawaii.edu
Wiliki will prompt you for your login id and password.
Once you've logged into wiliki, you will see the prompt:
-bash-3.2$
wiliki has the LINUX operating system
that uses the command shell bash.
A command shell is a program that allows a user to type certain
commands, that manage files and run executable programs. Bash is
a UNIX-like shell.
Users can type in commands (e.g., "cp" for copy a file, or "mv" for
move a file), and these commands will be interpreted and acted upon by
the shell.
At this point you are interacting with a program referred to as a shell. These programs are responsible for interpreting and carrying out the commands you type. There are different types of shells, but the one you want to work with is the C shell. To check if you're interacting with C shell, type
echo $SHELL
(NOTE: Unix is ``case sensitive'' meaning upper and lower case
letters are different. You should type the above command to your shell
exactly
as shown above). You should see the response
/bin/bash
that you are using the bash shell.
Now you can start typing shell commands. Since the commands may be difficult to remember. It's rea helpful to be able to customize your environment. This can be accomplished by having two data files called
An alias is a way of renaming commands. For example, suppose in your .bashrc file you have the line
alias goodbye = 'logout'
Then whenever you type goodbye, the shell will first look into your .bashrc file. It will notice that there's an alias for goodbye. So it knows that you want the command logout to be executed.
Set-path is a way of letting the C shell know that you want access to files outside your own directory. For example, suppose in your .bashrc file you have the line
set path=(/users10/ee/fac/einstein/goodies)
This means that you would like the shell to consider what's in directory "goodies", that's in directory "einstein" (that is owned by a Professor Einstein). Then whenever you try to execute a program, the shell will first search for the program in your directory. If it can't be found, it'll examine the .bashrc file. It'll notice that the program could be in the "goodies" directory of Prof. Einstein. If it finds it there, it'll execute it.
NOTE: type this command exactly as shown --- particularly the ``dot'' (.) in the names above. What you have just done is to copy (by using the command ``cp'') the file, called bashrc, to your working space. The copied file is called .bashrc. To check if the file has been copied over type ``ls -a,'' which will list all the files in your working space. Here, ls is the list command and -a is the ``all'' option. Now if you do an ls, you will see that there is still nothing there. That is because, without the -a option, ls does not list files with a dot as their first character.
To make sure that the set-path is properly installed in .bashrc, type
testenv
If some program runs then it's been installed properly. Otherwise, you'll get some error message. Quit the program if you got it running.
The environment defined by the .bashrc file will will not go into effect until you login again. But before we do that, there is one more change we can set up.
The password you were given on your account is probably a sequence of random letters and numbers --- this can be hard to remember. You might like to change the password to something you can remember better. (You don't have to do this now, if you would like to think about what you want to use for your password).
Unix allows you to choose your own password (with some restrictions) using the passwd command. You should choose something that you will remember, but that will not be easy for someone else to guess. You SHOULD NOT use things like your login id or your name or minor variations of these. In addition, the system requires that your password be at least 6 characters containing at least two letters and at least one number character. If you have something in mind, you can change the password now by typing passwd. The system will prompt you to first enter your current password (to make sure it is really you) and then it will prompt you twice to enter the new password (to make sure you can type it twice in a row). From that point on, whenever you login, you will have to use the new password.
Try not to forget your password. There is no way for anyone to find out what it is for you, not even the system administrators. If you forget your password, you will have to see the monitors in POST 208 to ask them to put a new password on your account. You will need a picture ID and it may take a day or two for you to get the new password. You will not be able to use your account until then.
Now that we have set up all these changes to your account, as I have said, to make them all take effect, you must logout and log back in. To logout, you can use the logout command or the exit command. Typing these to the shell will end your session on wiliki. NOTE: if you are on a PC or Mac telnet'ed to wiliki, simply turning the computer off WILL NOT automatically log you out. To protect your account, you should always use the logout or exit command.
Go ahead and logout now, and then log back in using the same procedure as before. We will then do a little more exploring of the system. Go ahead.... I'll wait...
Welcome back...
You should now see that things look a little different. Your prompt now looks like:
YOUR LOGIN ID:wiliki:1>
If you check, you will also see that you are using csh. There are other subtle changes which may become evident later.
We will discuss how data and programs are stored in Unix. First, all data and programs are called files, where programs are called executable files. Directories are storage areas for files that can also store other directories. If you are familiar with ``Windows'' or Macintosh software, then directories function as ``folders.'' Recall that directories and files are organized into a tree.
To find out what directory you are in type
pwd
and you should get something printed out like this.
/users10/ee/fac/sasaki
which means that I'm in directory ``sasaki'', which is contained in directory ``fac'', which is contained in directory ``ee'', which is contained in directory ``users10''. Directory tep is the one I get into when I login, and is my home directory. The string of directories /users10/ee/fac/sasaki is known as a path.
To navigate around, we can use the following UNIX commands:
You probably don't have too many things in your home directory. So let's go to another directory that has more stuff in it. Change the current directory by typing
cd /inst/ee/ee260/ee260 or cd ~ee260
This will be referred to as the ee260 directory,
Type ls to list out the contents of the directory. You should see something like this:
Archive/ Lab0/ Lab3/ Lab6/ Lab9/ cshrc info
Help/ Lab1/ Lab4/ Lab7/ RunMe* garage/ login
Hex/ Lab2/ Lab5/ Lab8/ bin/ house/
The ee260 directory contains both directories and files. Example directories are "Help", "Hex", "Lab6", "bin". Notice that directories have the forward slash (`/') appended to them. This just indicates that they are directories rather than files.
Also notice that some of the files have the suffix "*" appended to them. This indicates that they are executable files, which means that they are programs that you can run. In fact, if you type
RunMe
The program RunMe will run.
To get back to your home directory type:
cd
Type ls to check. To get back to the handout directory, type
cd ~ee260
rather than the long pathname. The ``tilde'' character before the login name tells the system to figure out where the home directory of ee260 is. Now let's get into a subdirectory such as house. Type:
cd house
Type ls, and then type pwd to find out where you are. To get back to the parent directory (in this case the home directory), type:
cd ..
The ``..'' characters indicate you want to go up the directory tree.
Some of the directories in here are protected so that you cannot get into them. For example, try typing:
cd Archive
You get the message ``Archive: Permission denied'' which means you do not have permission to get into that directory and see what is there.
Your home directory should have been set up with all permissions turned off so that only you can get into it. This is a good way to protect what is stored there. (There are ways to change permissions on files and directories, but we will not describe that here. Ask around if you are interested).
Go into the Lab0 directory. You will find a data file called add.work, which contains additional (optional) assignments for the rest of this laboratory. The assignments will give you additional practice in using Unix.
You can view the contents of add.work by typing:
more add.work
The contents are displayed on the screen, one screenfull at a time.
Here are some useful commands.
rm file-name
mkdir directory-name
rmdir directory-name
However, the directory has to be empty before it can be removed.
mv current-file-name new-file-name
cp current-file-name another-file-name
Note that mv and cp are different because cp makes a duplicate of a file while mv just changes its name.
You will notice that directories are a nice way of organizing files. because you can put related directories and files in a common directory. Without directories, organization will be more difficult.
To keep organized you should have an EE260 directory to store all your class stuff.
Change to your home directory (type cd). Create a new directory by typing
mkdir EE260
(Note: I generally use the convention of naming my directories beginning with upper case letters and files with lower case letters, but this is just a convention, and you may choose your own). Now if you do an ls you will see:
EE260/
i.e. a new directory called EE260 in your home directory. You can change to that directory by typing:
cd EE260
Doing an ls there will show it to be an empty directory. We can copy over the add.work file by typing:
cp ~ee260/Lab0/add.work lab0
This copies add.work into the current directory and names the file ``lab0''. You can also create files related to EE 260 stuff in this directory. A few of the tools available on the system for doing this is given in the next section.
Finally, if you forget how to use any of the commands, you can use the on-line manual command man. For example, to list the user instructions for the command cp, simply type:
man cpTo scroll the instructions on the screen you can type space bar for new screenfull, return key for one line, or `q' to quit (just like the more command)