1 / 16

Introduction to UNIX

Introduction to UNIX. Dana Schaa. Brief History of UNIX. Developed at Bell Labs by Thompson, Kernighan, Ritchie and others Designed to be a multi-task, multi-user system Designed to be modular EVERYTHING is a file in UNIX accessed using read, write, execute operations. UNIX File Structure.

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 Dana Schaa

  2. Brief History of UNIX • Developed at Bell Labs by Thompson, Kernighan, Ritchie and others • Designed to be a multi-task, multi-user system • Designed to be modular • EVERYTHING is a file in UNIX • accessed using read, write, execute operations

  3. UNIX File Structure • Files treated as a hierarchy • Absolute paths begin at root (/) and access the same location regardless of current directory • Relative paths begin in the current directory

  4. Important Directories

  5. File Permissions • All files are owned by someone • Permissions are represented by 9 bits • 3 octal numbers • allow user (u), group (g), and others (o) to read (r), write (w), and execute (x)

  6. File Permissions (2) • Permissions required to perform certain operations in a directory • Read: list files in the directory • Write: create, rename, or delete files in the dir • Execute: read a file, write to a file, execute a file or script

  7. File Permissions (3) • Example: • >> chmod 0755 file.txt • 755  111 101 101  rwxr-xr-x • Can also modify 1 permission at a time • chmod +r file <-- allow everyone to read file • chmod u+x file <-- allows user to execute file • chmod go-w file <-- don't allow group or others to write to file

  8. Hidden Files! • Any file or directory that begins with a dot is “hidden” • Hidden files are those that don’t show up when a directory is read (using ls) • Hidden files must be asked for explicitly via “ls –a” • Configuration files are usually hidden because there are typically many of them in your home directory that you don’t need to access often

  9. Current and Parent Directories • Every directory contains at least two files: • Current ‘.’ • Parent ‘..’ • Examples: • >> cd . # remains in the same directory • >> cd .. # go up a level (unless in root dir) • The dot (.) is allowed in naming files and directories • a leading dot makes the file hidden

  10. Shells • A shell provides an interface to the UNIX kernel • “shell” is interchangeable with “command line” • Gnome and KDE are examples of graphical shells • The main purpose of the shell is abstraction • Example: • >> ls -l | sort > out • The shell handles • the parsing of your input • the fork/exec calls • the inter-process communication • the file redirection

  11. Shells (2)

  12. Shells (3) • Some popular shells • sh: bourne shell (used by root during boot) • bash: bourne again shell • csh: C shell • tcsh: enhanced csh • zsh: Z shell • All have slight variations but are similar • Variations include: • Command completion • History • Etc

  13. SSH – secure shell • Provides secure connections to remote machines • Encrypts passwords and data sent over internet >> ssh dschaa@ece.neu.edu >> ssh -X dschaa@ece.neu.edu <-- allows GUIs to be tunnelled through SSH • SFTP and SCP are equivalently used for file transfers • Use ‘man’ for more details

  14. man – man’s best friend • Extremely useful tool • man is an interface to reference manuals for UNIX commands and C system calls • Commands: • describes functionality • explains parameters • provides usage examples • System Calls: • lists required header files, • explains parameters, return value(s), and error values, • describes functionality, • provides usage examples

  15. UNIX Editors • The goal of every programmer should be that their hands never need to leave the keyboard • Available editors in UNIX: • Pico • A simple editor that is good for beginners • Don’t need to rely on your memory as much to use effectively • VI • Standard UNIX editor • VIM (vi-improved) • vi with more bells and whistles • EMACS • Endlessly customizable. Many bells and whistles • See “Editor war” in wikipedia for more details

  16. UNIX Editors (2) – VI vs EMACS • VI • is present in all Unix based operating systems as guaranteed by the POSIX standard • conforms with Unix design and philosophy, "do one thing, and do it well" • commands largely avoid the use of modifier keys such as Ctrl & Alt • EMACS • has a much larger set of built-in commands • can be used as a shell itself • available in GUI form • has a large number of customizations and other enhancements available

More Related