This is really the most basic set of cammands you will need to do basic stuff on your unix workstations. If you need more extensive help, the following web-site has excellent documentation on all topics! Unix Help for Users
STEP 1. Copy-and-paste the file into a notepad file called .cshrc_user on your PC
STEP 2. ftp the file over to your Unix account.
To show what files are in my directory:
% ls
ajfile1.doc ajfile2.doc ajfile3.text
As shown, there are three files in my directory.
How do I know which directory am I currently in ?
% pwd
/staff/ie/joneja
In your home directory (the directory in which you are when you first log in,
there are also some hidden files. You can see the names of these files by
using an option with the ls command. All hidden files have names starting with
a dot, example: .cshrc_user or .login_user
% ls -a
.login .login_user .cshrc .cshrc_user
Of the above hidden files shown, the files called .login_user and .cshrc_user
are similar to the AUTOEXEC.BAT and SETUP.INI files in DOS. You can edit the
.cshrc_user file, to customize your unix environment. For example, you could
get unix to automatically display your current working directory instead of
the usual promplt ( % ). Read the section under Index of 'S', on topic
Setting Prompt, in the
Unix documentation to see how this is done.
ajfile1.doc ajfile2.doc ajfile3.text
Creating a new directory
% mkdir public_html
% ls
ajfile1.doc ajfile2.doc ajfile3.text public_html
Changing directories: You can move between directories (folders) in exactly
the same way as you do in DOS. The command is called "cd".
% cd public_html
% pwd
/staff/ie/joneja/public_html
You create new files using a text-editor. A popular editor at UST is called pico. It works nearly the same as the EDIT command in DOS.
% pico index.html
Copying a file: the "cp" command can make a copies of a file:
Usage: cp ORIGINAL-FILE-NAME NAME-OF_COPY
% cp index.html index.backup
% ls
index.html index.backup
Deleting a file: delete a file by using the "rm" command, followed by one or more file-names. You may use *, or *.*, etc. in the file-names.
% rm index.backup
% ls
Renaming a file (changing the name of a file): this is done by using the "mv" command, as follows:
% mv index.html NewNameFile
% ls
One final command that is useful for web-page maintenance requires some
explaining. In unix, file access attributes are described by the following
specifiers: Each file can be accessed by YOU, a GROUP of users specified by
you, or by OTHERS (that is, all users of the computer). Further, each of these
three sets of users (you, group, or others) are allowed to either READ the
file, or WRITE to (modify) the file, or, if the file is an executable program,
EXECUTE the file. Therefore there are NINE attributes for each file:
READ, WRITE, EXECUTE for each type of users: OWNER (You), GROUP, OTHERS.
These attributes of a file are shown by the long-form output of the "ls" command:
% ls -l
1 -rw-r--r-- 1 joneja 4 Feb 4 16:13 index.html
Let's look at the attributes of the file; I will separate them into four
groups:
-, rw-, r--, r--
The first character indicates the file type ( - means it's a data file, d means it is a directory).
The next three characters indicate the attributes for the owner: rw- means the owner (in this case, joneja), can read, write, but NOT EXECUTE the file.
The next three characters, r-- mean that any group which can also use this file, as specified by the owner, can read this file, but cannot WRITE, and cannot EXECUTE this file.
Similarly, the last three characters, r--, indicate that OTHER users can only read the file, but not execute or write to it.In order for your web pages to be accessible to other people, you must change the mode (attributes) of the files in the following way:
(1) The directories public_html and all its sub-directories must be EXECUTE open for all users. Do this by typing:
% cd ~% chmod a+x public_html
(2) All HTML and IMAGE files should be read open to ALL (owner, group, others).
% cd public_html% chmod a+r public_html
(3) All CGI files must be executable for all (owner, group, others).
% mkdir cgi-bin% cd cgi-bin
Now edit all your CGI files (you will learn how to write CGI-scripts soon!)
% chmod a+x *
The "*" above means ALL files in the directory.
Using Perl and Sybase
You will use two unix programs extensively in this course. The first is perl. In fact, perl is a program that interprets and executes 'commands' that you write in the perl language. Your commands are stored in a file that you call your perl script. If you write your perl script in a file called MyFile.perl than you can execute this script by typing
% /usr/local/bin/perl MyFile.perl
However, it is convenient to tell Unix that the 'perl' command resides in the directory called /usr/local/bin/, by doing the following:
% cd
Now edit the file called: ".cshrc_user"
In this file, add this line at the end:
setenv PATH /usr/local/bin/:$PATH
After this line, add another line as follows:
setenv SYBASE /usr/local/sybasesince you will be using commands for sybase, it is better to also tell unix where the sybase commands are located, by adding the following line at the very end:
setenv PATH /usr/local/sybase/bin:$PATH
Save the .cshrc_user file, and exit the editor. Now run through the following unix command:
% user-setup
The command gives you many choices. Select choice 4, for database, and then select choice 2, for sybase. After you are done, save, apply, and quit.
However, you will only be able to run sybase later in the semester, after accounts have been created.
This is a very short UNIX introduction. You will need other commands -- the best way to learn them is (a) ASK you friends (b) ASK your TA, Instructor, (c) Read the manuals.
In Particular, the UNIX Users Information page is a great introduction, as well as a good user's manual !