1 / 29

CSC – 332 Data Structures Unix and Vi

CSC – 332 Data Structures Unix and Vi. Dr. Curry Guinn. Quick Info. Dr. Curry Guinn CIS 2045 guinnc@uncw.edu www.uncw.edu/people/guinnc 962-7937 Office Hours: MTWR: 11:00am-12:00pm and by appointment. The CSC server. babbage.cis.uncw.edu

rowena
Download Presentation

CSC – 332 Data Structures Unix and Vi

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC – 332 Data StructuresUnix and Vi Dr. Curry Guinn

  2. Quick Info • Dr. Curry Guinn • CIS 2045 • guinnc@uncw.edu • www.uncw.edu/people/guinnc • 962-7937 • Office Hours: MTWR: 11:00am-12:00pm and by appointment

  3. The CSC server babbage.cis.uncw.edu • A cluster of 6 Dell PowerEdge 1850s with 2 Dual core Intel Xeon 2.8GHz processors and an 800MHz frontside bus.  • Each machine has 12GBs of memory • Each machine has two 72GB U320 hard drives in a Raid 1 configuration.  • These machines will run Sun Grid Engine N1 with the Sun scheduler, MPI • The OS is Centos 4.1 (based on RedHat Enterprise server) which is rolled in with the Rocks Cluster

  4. Why Unix • The OS of choice in universities for 25 years • The OS of choice for networking • Unix can run on virtually any computer (IBM, Sun, HP, Macintosh,etc) • Unix is free or nearly free • Linux/open source software movement • RedHat, FreeBSD, MKLinux, LinuxPPC, etc.

  5. Stable and Efficient • Unix is very stable - computers running Unix almost never crash • Unix is very efficient • it gets maximum number crunching power out of your processor (and multiple processors) • it can smoothly manage extremely huge amounts of data • Once learned, the user interface allows for functionality that does not exist in GUI-based OS

  6. Unix has some Drawbacks • Unix computers are controlled by a command line interface • Not terribly user-friendly • Somewhat difficult to learn • Hackers can exploit Unix/Linux • There are security holes • There are many different versions of Unix with subtle (or not so subtle) differences

  7. Program Management • Every program is independent • The core operating system (known as the kernel) manages each program as a distinct process with its own little chunk of dedicated memory. • If one program runs into trouble, it dies, but does not affect the affect the kernel or the other programs running on the computer.

  8. The Unix Shell • You communicate with a Unix computer through a command program known as a shell. • The shell interprets the commands that you type on the keyboard. • There are actually many different shells available for Unix computers, and on some systems you can choose the shell in which you wish to work. • You can use shell commands to write simple programs (scripts) to automate many tasks

  9. Unix Commands • Unix commands are short and cryptic like vi or rm. • Very fast; you will get used to it. • Every command has a host of modifiers which are generally single letters preceded by a hyphen: ls -l or mv -R

  10. Wildcards • You can substitute the * as a wildcard symbol for any number of characters in any filename. • If you type just * after a command, it stands for all files in the current directory: cat *will write all files to the screen • You can mix the * with other characters to form a search pattern: ls a*.txt will list all files that start with “a” and end in “.txt” • The “?” wildcard stands for any single character

  11. Control Characters • Control commands that work (almost) any time • ctrl-C will abort any program • ctrl-S suspends (halts) output scrolling up on your terminal screen • ctrl-Q resumes the display of output on your screen

  12. Getting Help in Unix • There is a rudimentary Help system which consists of a set of "manual” pages for every Unix command. • The man pages tell you which options a particular command can take, and how each option modifies the behavior of the command. • Type man and the name of a command to read the manual page for that command.

  13. Unix Help on the Web Here is a list of a few online Unix tutorials: • Unix for Beginners http://www.ee.surrey.ac.uk/Teaching/Unix/ • Unix Guru Universe http://www.ugu.com/sui/ugu/show?help.beginners • Getting Started With The Unix Operating System http://iss.leeds.ac.uk/info/313/unix/185/getting_started_with_the_unix_operating_system/1

  14. Unix Filenames • Unix is case sensitive • UNIX filenames contain only letters, numbers, and the _ (underscore), . (dot), and - (dash) characters.

  15. Filename Extensions • Most UNIX filenames start with a lower case letter and end with a dot followed by one, two, or three letters: myfile.txt • However, this is just a common convention and is not required. • It is also possible to have additional dots in the filename. • The part of the name following the dot is called the “extension.” • The extension is often used to designate the type of file.

  16. Working with Directories • Directories are a means of organizing your files on a Unix computer. • They are equivalent to folders in Windows and Macintosh computers • Directories contain files, executable programs, and sub-directories

  17. Your Home Directory • When you login to the server, you always start in your Home directory. • Create sub-directories to store specific projects or groups of information, just as you would place folders in a filing cabinet.

  18. File & Directory Commands • This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir (make directory) cd (change directory) rmdir (remove directory) cp (copy) pwd (present working directory) mv (move) more (view by page) rm (remove) cat (view entire file on screen) • All of these commands can be modified with many options. Learn to use Unix ‘man’ pages for more information.

  19. Navigation • pwd (present working directory) shows the name and location of the directory where you are currently working: $ pwd /home/faculty/guinnc • This is a “pathname,” the slashes indicate sub-directories • The initial slash is the “root” of the whole filesytem • ls (list) gives you a list of the files in the current directory:$ ls CLASSES mbox Misc public_html subdir TORVALDS voicedata • Use the ls -l (long) option to get more information about each file $ ls -l total 32 lrwxrwxrwx 1 guinnc guinnc 20 Jul 19 10:17 CLASSES -> /home/classes/guinnc -rw------- 1 guinnc guinnc 11258 Aug 18 10:54 mbox drwxrwxr-x 2 guinnc guinnc 4096 Aug 20 11:13 Misc drwxr-xr-x 2 guinnc guinnc 4096 Jul 18 10:15 public_html drwxrwxr-x 2 guinnc guinnc 4096 Aug 20 11:26 subdir drwxr-xr-x 6 guinnc guinnc 4096 Jul 18 10:16 TORVALDS drwxrwxr-x 3 guinnc guinnc 4096 Aug 7 14:01 voicedata

  20. Sub-directories • cd (change directory) moves you to another directory $ cd Misc $ pwd $ /home/faculty/guinnc/Misc • mkdir (make directory) creates a new sub-directory inside of the current directory $ ls CLASSES mbox Misc public_html TORVALDS voicedata $ mkdir subdir $ ls CLASSES mbox Misc public_html subdir TORVALDS voicedata • rmdir (remove directory) deletes a sub-directory, but the sub-directory must be empty $ rmdir subdir $ ls CLASSES mbox Misc public_html TORVALDS voicedata

  21. File Commands • Unix directory structure revisited • 'cd ~' change directory to your home • 'cd ~guinnc' change directory to guinnc's home • 'cd ..' change directory to upper directory • 'cd / ' change directory to root • Use tabs to complete the file name (write partial file name and then use tab)

  22. Commands for Files • cat dumps the entire contents of a file onto the screen.

  23. more or less • Use the command more (or less) to view at the contents of a file one screen at a time: Hit the spacebar to page down through the file • b moves back up a page • At the bottom of the screen, more shows how much of the file has been displayed

  24. Copy & Move • cp lets you copy a file from any directory to any other directory, or create a copy of a file with a new name in one directory cp filename.ext newfilename.ext cp filename.ext subdir/newname.ext cp /u/jdoe01/filename.ext ./subdir/newfilename.ext • mv allows you to move files to other directories, but it is also used to rename files. • Filename and directory syntax for mv is exactly the same as for the cp command. • mv filename.ext subdir/newfilename.ext • NOTE: When you use mv to move a file into another directory, the current file is deleted.

  25. Delete • Use the command rm (remove)to delete files • There is no way to undo this command!!! • The rem program in my bin directory. • Puts files in your .wastebasket • Go ahead and copy my .bash_profile and .vimrc into your home directory

  26. Moving Files between Computers • You will often need to move files between computers - desktop to server and back • There are several options • E-mail • FTP • SSH Secure Shell has a nice file transfer utility under the Menu “Windows”

  27. Vi Tutorial • http://people.uncw.edu/guinnc/courses/Fall12/332/notes/day2_unix/vi.ppt

  28. For Next Class, Tuesday • For Tuesday • Read Weiss, Chapter 1 • Focus on 1.4 and 1.5 • Quiz, due Tuesday night, 11:59pm • Homework 1 due Thursday, 08/30

More Related