DOC PREVIEW
FSU COP 3330 - LECTURE NOTES

This preview shows page 1-2-3-25-26-27 out of 27 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture Notes COP 3344 Introduction to Unix Page 1 Dr. David A. Gaitros, Copyright 2007 COP 3344 Lecture Notes Supplement Dr. David A. Gaitros References Unix System Administration Handbook, Second Edition, Nemeth, Snyder, Seebass, Hein, Prentice Hall 1995 Linux Clearly Explained, Phaffenberger, Morgan Kaufmann, 1999 Unix for Dummies, Quick Reference 4th Edition, Young and Levine, IDG Books Worldwide, 1998 Unix man pagesLecture Notes COP 3344 Introduction to Unix Page 2 Dr. David A. Gaitros, Copyright 2007 echo Send it’s output to the console. Usually used in login or similar types of scripts where you want to send some type of message or status to the user. Format: echo [-n] text to display -n Does not begin a new line after echo. Example: echo –n “Your Report is Now Printing” man Displays reference manual page for Unix commands. . Format: ma [-k keywords] topic -k Specifies one or more keywords to search for. Example: man lsLecture Notes COP 3344 Introduction to Unix Page 3 Dr. David A. Gaitros, Copyright 2007 alias Creates an alias for a command or shows which aliases exist for your process. Used mostly in login or setup scripts to set complex variables or to make commands more friendly to use. Used in C, Bash, or Korn shells only. Format (C shell): alias [name [‘command’]] Example: alias dir ‘ls –al’ Format (Korn and Bash shells): alias [name=[‘command’]] Example: alias dir=’ls –al’ Aliases created when you are logged in are not saved when you log out. You should add any aliases you want to keep to your start up files.Lecture Notes COP 3344 Introduction to Unix Page 4 Dr. David A. Gaitros, Copyright 2007 awk Awk is a programming language designed to make many common information retrieval and text manipulation tasks easy to state and to perform. The name awk comes from the names of its creators Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan. A GNU version of awk, called gawk, is also in wide use (and is recommended). (Also, for most practical purposes, the awk programming language has been superseded by Larry Wall's perl language.) The basic operation of awk is to scan a set of input lines in order, searching for lines which match any of a set of patterns which the user has specified. For each pattern, an action can be specified; this action will be performed on each line that matches the pattern. Format: awk [-f program] file -f Specifies that a filename contains the awk program. Otherwise you put the awk program between single quotes. Example: awk '{print $1,$2,sin($3/$2)}' filename This command will print the first and second fields, and then the sine of the third field divided by the second. So, the second and third field had better be numbers. Awk has other built in math functions like sine; read the Unix man page for others.Lecture Notes COP 3344 Introduction to Unix Page 5 Dr. David A. Gaitros, Copyright 2007 cal Prints a calendar for a month or a year If you just type cal with no month or year, you get a calendar for the current month. If you provide a year but no month, you get the whole year. You can redirect the output to a file if you wish. Format: cal [month][year] [month] Specifies the month 1-12 [year] specifies year from 1 - 9999 -n Does not begin a new line after echo. Example: cal 12 1999 > calendar.output.dat Note: Pope Gregory XIII took the advice of his mathematicians and shortened October of A.D. 1582 by ten days to correct problems with the current calendar. Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October 15, 1582 (Gregorian). Getting dates using cal before this date or after 9999 are not advisable.Lecture Notes COP 3344 Introduction to Unix Page 6 Dr. David A. Gaitros, Copyright 2007 more Displays the contents of a file or information to the output one screen at a time so that you can read it easily. Format: more [-s][-u][+/text][filename] -s Suppresses extra blank lines -u Ignores underscores and backspace +/text Starts to display file two lines before the start of the ‘text’ that is found in the file. Example: more +/windows .login ls | more Note: The last example takes the output of the ls command and uses more to display the contents of the directory command one page at a time.Lecture Notes COP 3344 Introduction to Unix Page 7 Dr. David A. Gaitros, Copyright 2007 cat Displays a file to the screen. Only works with text files and displays the WHOLE file at once without stopping. Difficult to look at large files. This command was used before there was a convenient ftp method to transfer files. Often used to concatenate files. The command “more” is used instead. Format: cat filename [filename] Example: cat file1 file2 file3 file4 >one.big.file Note: The above example takes four files and places them one after another and puts the results in a file called one.big.fileLecture Notes COP 3344 Introduction to Unix Page 8 Dr. David A. Gaitros, Copyright 2007 cd Literally this stands for change directory. Moves forward or backward. To go to your home directory, just type cd with no other input. Format: cd [directory] Examples: cd .. cd ~gaitrosd cd /home/bin/ cd ../public_html/classes/cop3344 cd ../../MorphBankv2.2/bin/utils Note: The two periods (..) indicate the parent directory of the current directory ( so one up). A single period (.) indicates the current directory.Lecture Notes COP 3344 Introduction to Unix Page 9 Dr. David A. Gaitros, Copyright 2007 rm Removes a file or files from a directory. Actually, like the Windows delete command this just removes the entry in the directory table. It does not erase the contents. You cannot “undelete” a file. Format: rm [-i][-r] filename [-i] Ask to confirm before delete [-r] Performs the delete operation in all subdirectories. Examples: rm text.junk rm –i text.junk rm *.out rm *.* rm –ir *.*Lecture Notes COP 3344 Introduction to Unix Page 10 Dr. David A. Gaitros, Copyright 2007 mkdir Creates a new directory. Your account must have write privileges in order to do this. You should only create directories and sub-directories within you own account. Format: mkdir directory Example: mkdir tempdir rmdir Removes a directory. Your account must


View Full Document

FSU COP 3330 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?