Information technology students should complete Assignment Questions 1 to 3 inclusive.
UNIX comes in many similar versions with very little differences. golum is a 64-bit DEC alpha machine running a version of UNIX called Digital UNIX V3.2C Worksystem Software (Rev. 148).
UNIX versions such as LINUX are also available for personal computers.
The MIS 3000 Survey results reveal the 1995 MIS trends in Australia. Our MOO server has been on various UNIX machines since September 1994. AussieMOO started out with Digital's ULTRIX, then moved to HP-UX before resting awhile with SUN's Solaris on the farrer SUN Sparc 4 machine. The tables below show the percentage of host operating systems, with UNIX as a clear industry leader, as well as the breakdown of variant UNIX platforms.
Table 1 Host Operating Systems 1995 % UNIX 51.4 IBM OS/400 22.9 DEC VMS 16.7 PICK 6.3 HP MPE 5.6 Wang VS 5.5 IBM MVS 4.5 Others xx Table 2 UNIX variant platforms % SunOS 13.5 HP/UX 11.4 AIX 10.5 SVR4 8.1 Solaris 5.3 SCO Unix 3.9 Ultrix 3.5 DG/UX 3.4 OSF/1 2.4 Dynix 1.4 OSX 1.4 Others 7.8
The vast number of machines on the Internet running UNIX, makes it worthwhile to know how to manage files and to communicate with a remote UNIX machine. This document is meant to be a quick start guide for multiuser-computing professionals who have found a need to learn UNIX and the X-window interface. The lists of commands and exercises are arranged into functional groups rather than as an alphabetical listing.
Tree Key: / (root) / root directory / \ usr contains many sub-directories usr bin most frequent system commands / \ users contains user areas bin users acstaff academic staff user area \ bsimpson bsimpson user area acstaff \ bsimpsonFinding your way around the UNIX directories is very similar to the pathway in most hierarchical trees found in other common operating systems such as DOS. The next section contains the list of commands concerned with UNIX files and directories.
passwd change login password date print date cal 1994 print calendar help ask for help who who is on the system write write to another user man print manual entries ctrl - D logout logout terminate the session learn computer instruction ls list contents of directory ls -l long format of the list ls -ld long format of a requested directory ls -a list all entries in the current directory ls -al list all entries in long format pwd print working directory cd .. change to parent directory cd / change to the root directory cd usr/users/acstaff/bsimpson change to users home directory cd home } cd bsimpson } change to the home directory cat concatenate files (type on screen) more file perusal filter (scrolling)
Text Buffer While using vi to edit an existing file, you are actually working on a copy of the file that is held in a temporary buffer. If you invoked vi with a new filename, (or no file name) the contents of the file only exist in this buffer.
Saving a file writes the contents of this buffer to the permanent file, replacing its contents. You can write the buffer to a new file or to some other file.
You can also decide not to write the contents of the buffer, and leave your original file unchanged.
vi filenameThe filename can be the name of an existing file or the name of the file that you want to create.
No write since last change
You can either save the changes or quit without saving any of the changes you have made. To quit vi and save the contents of the buffer to the file that vi is being used to edit: ZZ or :wq
To quit vi without saving the contents of the buffer to the file::q!
To quit vi and save the contents of the buffer to a new file:
:w filename :q
An excellent vi tutorial exists at: UMICH
Window Motionsd Scroll down (half a screen) u Scroll up (half a screen) f Page forward b Page backward /string Search forward ?string Search backward n Repeat search N Repeat search reverse G Go to last line nG Go to line n :n Go to line n 1 Redraw screen g File information Cursor Motions H Upper left corner (home) M Middle line L Lower left corner h Back a character j Down a line k Up a line ^ Beginning of line $ End of line l Forward a character w Forward one word b Back one word fc Find c ; Repeat find (find next c) Input Commands (end with ESC) a Append after cursor i Insert before cursor o Open line below O Open line above :r file Insert file after current line Changes during insert mode h Back one character w Back one word u Back to beginning of insert Move text from file old to file new vi old "a10yy Yank 10 lines to buffer a :w Write work buffer :e new Edit new file "ap Put text from a after cursor Deletion Commands dd Delete line ddn Delete n lines to general buffer dw Delete word to general buffer dnw Delete n words d) Delete to end of sentence db Delete previous word D Delete to end of line x Delete character Recovering deletions p Put general buffer after cursor P Put general buffer before cursor Change commands s Substitute (ESC) - 1 char with string cw Change word (ESC) cc Change line (ESC) - blanks line c$ Change to end of line rc Replace character with c R Replace (ESC) with - typeover . Repeat last change Undo commands u Undo last change U Undo all changes on line Rearrangement commands yy or Y Yank (copy) line to general buffer "z6yy Yank 6 lines to buffer z yw Yank word to general buffer "a9dd Delete 9 lines to buffer a "A9dd Delete 9 lines; append to buffer a "ap Put text from buffer a after cursor p Put general buffer after cursor P Put general buffer before cursor J Join lines File management commands :w name Write edit buffer to file name :wq Write to file and quit :q! Quit without saving changes zz Same as :wq :sh Execute shell commands ( d) Parameters :set list Show invisible characters :set nolist Don't show invisible characters :set number Show line numbers :set nonumber Do not show line numbers
Privilege levels:
user group others
File operations:
r (read) w (write) x (execute)
This information is available for each file and is coded in the following style:
-rwxrwxrwx for a file drwxrwxrwx for a directory file Key: -rw-r--r-- ^ ^ ^ ^ a b c d where a = the file type b,c,d = rwx for user, group and others, in order. -rwxrwxrwx is read, write and execute for everyone dr-xr-xr-x is a directory to read and search only, for everyone.
Now apply these components of a typical directory listing in long format:
Long format directory listing
The long format of a directory file listing contains a lot of useful information such as the privileges attached to the file. The following example of such output has been labelled to indicate what it all means.
-rw-r--r-- 1 bsimpson acstaff 417 May 24 17:24 README ^ ^ ^ ^ ^ ^ ^ a b c d e f g
The following key reveals the meaning of the other components from the above example in the long format directory listing in UNIX:
a = link count d = byte size b = owner name e, f = date and time of last modification c = group name g = filename
The mode for the listing above indicates that the file has read only access for everyone and write access to the user or owner!
Creating, Managing, Deleting and Protecting files This list of commands are useful when editing, managing and protecting the files in your UNIX account.
cpcopy files chmod change mode (rwx file privileges) umask set file creation mask rm remove files rm -r recursively remove all files in a directory mv move or rename files mkdir make a directory du summarise disk usage pr print file * regular expression wildcard head -2 print the first 2 lines of a file tail -4 print the last 4 lines of a file find find files whereis locate program file determine the file type ln make a link to another file split split a file into pieces df print free disk space quota display quota limits tar tape file archiver pack pack files unpack unpack files cmp compare two files diff find file differences uniq report repeated files sort sort and/or merge files join database relational operator fgrep search file for a string egrep search file for an expression wc word count dd convert and copy a file crypt encrypt or decrypt a file jobs print list of jobs fg resume job in foreground bg resume job in background stop suspend a background job shl shell layer manager ps report process status sleep suspend execution kill terminate a process at
Special Shell variables, Editors, Communications
Shell variables: set set values of variables path defines the sequence of searched directories setenv set the environment variables printenv print the environment variables unsetenv remove the environment variables Editors: ed text editor vi screen-oriented editor ex text editor available within vi Communications: uucp UNIX to UNIX copy uuname list names of systems uulog print logging information mail send and receive mail news print news items readnews read news items checknews check if there are any news items postnews submit news items
cat resume.txt > cv.txt
This command will cause the output of the file called resume.txt to be copied to a file called cv.txt instead of to the terminal screen.
UNIX uses a variety of mechanisms for interprocessor communication and the PIPE is often described as the most significant. The Pipe is a circular buffer which allows two processes to communicate as part of a producer/consumer model. It is a first- in, first-out (FIFO) queue which is written by one process and read by the other. Piping creates a a fixed size (bytes) buffer in memory and only one process can access the pipe at one time. The | character, used in piping, is detected by the sh ell or command language interpreter and causes the command on the left of the | to be the input of the command on the right of the | character. One common use is with the file perusal filter command: more
ls -l | more
This command is useful when looking at large directory or file. By piping the output of the ls command into more, the output will stop at the first page, allowing you to scroll through at your control.
cat parta partb 2>&1 | lp
This command spools the output of two files called parta and partb to a line printer, and combines the notions of redirection and piping.
golum> date Thu Jul 21 20:43:42 EST 1997 golum> cal July 1995 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 golum> cal 8 1994 golum> cal 10 1996 golum> who bsimpson tty05 Jul 21 20:18 u9230045 ttyp0 Jul 21 20:09 (spc.riv.csu.edu.au) golum> pwd /usr golum> ls -l total 15194 -rw-r--r-- 1 bsimpson acstaff 417 May 24 17:24 README drwxr-xr-x 4 bsimpson acstaff 512 Jul 20 15:15 stut -rw-r--r-- 1 bsimpson acstaff 14475264 May 24 17:24 stut_nn.tar golum> cat README contents of the files Goodluck and let me know if you have any problems. AussieMOO
golum> ls -l golum> cd home golum> ls -a golum> cd / golum> pwd golum> ls -l | more golum> ls -a golum> ls -ld golum> df
Checklist of commands Actual Test used more cat assign1.txt | more ........................... .......................... ........................... .......................... ........................... ........................... ........................... ........................... ........................... ...........................
pineto send an e-mail message to your lecturer, a courtesy-copy (cc) to yourself at golum.riv.csu.edu.au, with bio.txt as an attachment.
jsmith99in the e-mail link below:
<HTML> <HEAD> <TITLE>Quick Home Page</TITLE> </HEAD> <BODY> <H1> Heading level one of six</H1> <HR> <H3>Welcome to my first Home Page.</H3><P> The last word in this line is <B>bold</B>.<BR> <UL> <LI>First bulleted item in unordered list </LI> <LI>The following word is in <I>italics</I></LI> <LI>This is a link to the <A HREF="http://www.csu.edu.au">CSU Home Page</A> <LI>This is the last item in the list</LI> </UL> <HR> <ADDRESS><A HREF="mailto:jsmith99@postoffice.csu.edu.au">Your name goes here</A> </ADDRESS> </BODY> </HTML>
Use CTRL-X to exit and save index.html
Compiled by Ken Eustace, 1996