1 / 27

Introduction to Unix

Introduction to Unix. CS240 Computer Science II. The UNIX Environment. Typical UNIX File System. Important Directories and Files. / (root): the top of the file hierarchy /export/home: usually contains all users’ subdirectories.

eldora
Download Presentation

Introduction to Unix

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. Introduction to Unix CS240 Computer Science II

  2. The UNIX Environment

  3. Typical UNIX File System

  4. Important Directories and Files • / (root): the top of the file hierarchy • /export/home: usually contains all users’ subdirectories. • /usr: traditionally contains subdirectories that keep system information. • /usr/bin: usually contains the standard Unix utilities. • /usr/sbin: contains utilities for system administration. • /etc: keeps configuration and other administration files, e.g., /etc/passwd contains a list of all users. • /var: contains files that vary as the system runs, e.g., users’ mailbox files, system log files, etc. • /dev: contains information about peripheral devices. • /tmp: used by programs to hold temporary files.

  5. Unix Standards • Two groups • System V: led by AT&T and Sun Microsystems; newest version is System V Release 4. • BSD (Berkeley Standard Distribution): the Open Software Foundation (OSF) led by IBM and HP; newest version is OSF/1. • Both standards conform to standards set by Portable Operating System Interface (POSIX). • Solaris from Sun Microsystems • AIX from IBM • HP-UX from Hewlett Packard • IRIX from Silicon Graphics

  6. Commercial Unix Systems

  7. Utilities or Utility Programs • More than 200 application programs such as editors, graphic user interface, search and sort routines, and some shell programs are integrated into the standard Unix operating system. Many other commercial and free programs such as compilers, spreadsheets, and desktop publishing tools are available and can be easily added to the system.

  8. The Shell • A shell is a command interpreter; it interprets the command enter by a user and calls the program the user wants. • A shell can be used as a high-level programming language in that shell commands can be arranged and stored in a file for later execution. • There are three popular shells in use today: the Bourne, the C Shell, and the Korn Shell. Korn shell is a superset of Bourne shell. A user may specify the shell he or she wants to use.

  9. Run a Utility Program in a Shell • Each utility program is uniquely identified by its name such as passwd, date, or ls, etc. To run a utility, just type in the name of the utility and press the enter key.

  10. Frequently Used “Directory” Related Utilities • pwd: displays current directory. • mkdir: creates a new subdirectory. • cd: changes to another directory. • rm: removes a file. • rmdir: removes a directory. • ls: lists contents of the current directory. • which: displays the full path name of a utility. • whereis: displays the pathname of a utility.

  11. Frequently Used “File” Related Utilities • pico: starts the “pico” text editor • vi: starts the “visual” text editor. • cat: displays the content of a file. • wc: counts the words in a file. • cp: copies a file. • more, page, head, tail: displays the content of a file. • file: displays information about the contents of a file. • diff: displays the difference between two files. • grep: searches for a particular strings in a file. • sort: orders a file by lines. • mv: renames a file. • lp: prints a file. • lpstat: displays the status of all print jobs. • cancel: removes specified jobs from the printer queue. • chmod: specifies the accessibility of a file. • ln: makes a link to an existing file.

  12. Other frequently used utilities • passwd: changes password. • date: displays today’s date. • clear: clears the screen. • man: displays information about a particular utility. • groups: displays list of all the groups to which the user belongs. • mail, mailx: sends and reads emails. • who: • finger: displays information about users. • write: sends a message to another user who is logged in. • talk: initiates a online conversation with another user who is logged in. • compress: compresses a file. • uncompress: restores a compressed file.

  13. List of commands with more detailed discussions • man • ls • vi • pwd • mkdir • rmdir • more • mailx • chmod

  14. The man command • lklm,

  15. The ls command

  16. The three modes of vi Editor

  17. Fucntions of the three mode in vi • Input mode: allows text such as source code to be entered. • Command mode: allows various commands to be entered for text editing and other purposes. Several commands such as insert, append, open, replace, and change that are issued in the command mode will take you to the input mode. • Last-line mode: all commands that start with a colon : puts vi in the last-line mode. Note: all text entered is temporarily kept in a buffer until permanently saved to disk.

  18. Starting vi

  19. Adding text filename: from command to input mode; must press Escape key to return to command mode

  20. Some moving cursors in the command mode

  21. Miscellaneous Commands

  22. viewing different parts of the buffer in the command mode

  23. Customizing the vi environment: the set command • In the command mode type :set followed by a parameter listed below and press enter key. • all: lists a complete list of parameters and their current status. • atuoindent (or ai)creates tab stops; Ctrl+T tabs right and Ctrl_D tabs left. noautoindent or noai turns off autoindent feature. • shiftwidth=nn sets the spacing (#characters) between tab stops • number to display line numbers; nonumber remove line numbers. • wrapmargin=nn, where nn is arbitray positive integer representing # characters after which wrap-around takes place. • showmode displays the mode type; noshowmode removes the display. • Note that the parameters can be permanently set in a user’s startup file .profile With Bourne or Korn shell, or .login with C shell. The parameters may also be set in a .exrc file.

More Related