1 / 109

Part One

Part One. The Essence of UNIX. Overview. Unix history Origins, versions, distributions Using Unix Log in/out Unix shells Basic commands Editor(s) Compile a C/C++ program. Introducing the UNIX Operating System. UNIX is a multi-user system

kenton
Download Presentation

Part One

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. Part One The Essence of UNIX

  2. Overview • Unix history • Origins, versions, distributions • Using Unix • Log in/out • Unix shells • Basic commands • Editor(s) • Compile a C/C++ program

  3. Introducing the UNIXOperating System • UNIX is a multi-user system • Allows many users access and share the resources of a server computer • UNIX is a multitasking system • Allows user to execute more than one program at a time • UNIX is a portable operating system • Used in many computing environments

  4. Unix History • Bell Labs … • UC Berkeley … • Commercial versions: • Solaris, Irix, HP/UX, Ultrix, SCO Unix, AIX, … • Open source versions: • FreeBSD • Linux

  5. Linux and UNIX • Linux is UNIX-like • Created by Linus Torvalds • Not written from traditional UNIX code • Linux is original code • follows POSIX standards

  6. Linux Structure

  7. Linux Distributions • Many companies have createdLinux distributions • distributions contain • source code for the Linux kernel and utilities • installation tools • professional documentation • technical support, • specialized software • They can charge as much as they choose for their Linux distributions

  8. Linux Distributions

  9. UNIX Concepts • Shell • The interface between user and OS • Hierarchical Structure • Directory and subdirectory organization • Layered components • Layers of software cover hardware

  10. Choosing Your Shell • Shells interpret commands and act as first-class programming language • A default shell is associated with your account when created • A list of some UNIX shells: • Bourne • C shell • Korn • Bash, tcsh

  11. Choosing User Names and Passwords • To use UNIX, a user must log in by providing a unique user name and password • UNIX system administrators create accounts by adding user names and passwords

  12. Connecting to a UNIX System • Directly via attached terminal • Via terminal window in windowing system • Remotely through telnet, rsh or ssh

  13. Connecting to UNIXUsing Telnet • telnet is terminal emulation software • Deemed insecure • Better: ssh • connects to Unix server • Once connected to a UNIX host, work with UNIX may begin • Uses IP addresses or domain names to access remote systems

  14. Entering Commands • To interact with UNIX, a command is entered at the command prompt • UNIX is case-sensitive and most commands are typed in lower case • Two categories of commands • User-level: perform tasks • System administration: system management

  15. Entering Commands • The date command • Displays the system date, which the system administrator maintains • The cal command • Shows the system calendar • The who command • Shows who is using the system and their current location

  16. Entering Commands

  17. Entering Commands

  18. Entering Commands

  19. Entering Commands • Command-line editing (shell dependent) • Certain keystrokes perform command-line editing • Use up and down arrow keys to scroll through command history • Multiple command entry • Separate commands with semicolon(;) • The clear command • Clears the current screen

  20. Getting Help The man program displays the UNIX online reference manual, called the man pages, for help purposes

  21. Viewing Files • Use cat, more, and less to view an entire file contents • cat displays a whole file at one time • more displays a file one screen at a time, allowing scroll down • less displays a file one screen at a time, allowing scroll down and up

  22. Viewing Files • Use head and tail to view the first few or last few lines of a file • head displays the first few lines • tail displays the last few lines

  23. Logging Out of UNIX • Logging out ends your current process and indicates to UNIX that you are finished • Logging out is shell dependent • Bourne, Korn, Bash – exit command • C shell – logout command

  24. Changing Passwords • For security purposes, changing passwords is necessary • Use the passwd command • UNIX allows new password if: • The new password differs by at least three characters • It has six or more characters, including at least two letters and one number • It is different from the user name

  25. Understanding the Role of the UNIX System Administrator • User “root” manages the UNIX system • Adds users and deletes old accounts • Also called the superuser • Unlimited permission to alter system

  26. Unix file system

  27. Understanding the UNIXFile System • A file is the basic component for data storage • UNIX considers everything it interacts with a file • A file system is UNIX’s way of organizing files on mass storage (disk) devices • A physical file system is a section of the hard disk that has been formatted to hold files • The file system is organized in a hierarchical structure similar to an inverted tree

  28. Understanding the Standard Tree Structure • The structure starts at the root level • Root is the name of the file at this basic level and it is denoted by the slash character (/) • A directory is a file that can contain other files and directories • A subdirectory is a directory within a directory • The subdirectory is considered the child of the parent directory

  29. Exploring the Root File System • UNIX must mount a file system before any programs can access files on it • To mount a file system is to connect it to the directory tree structure • The root file system is mounted by the kernel when the system starts

  30. Exploring the Root File System • The root directory contains sub-directories that contain files: • /bin contains binaries, or executables needed to start the system and perform system tasks • /boot contains files needed by the bootstrap loader as well as kernel images • /dev contains system device reference files

  31. Exploring the Root File System • Root subdirectories continued: • /etc contains configuration files that the system uses when the computer starts • /lib contains kernel modules, security information, and the shared library images • /mnt contains mount points for temporary mounts by the system administrator • /proc is a virtual file system allocated in memory only

  32. Exploring the Root File System • Root subdirectories continued: • /root is the home directory of the root user, or the system administrator • /sbin contains essential network programs used only by the system administrator • /tmp is a temporary place to store data during processing cycles • /var contains subdirectories which have sizes that often change, such as error logs

  33. Understanding Pathsand Pathnames • To specify a file or directory, use its pathname, which follows the branches of the file system to the desired file • A forward slash (/) separates each directory name • The UNIX command prompt may indicate your location within the file system • Use the UNIX pwd command to display the current path name

  34. Navigating the File System • To navigate the UNIX directory structure, use the cd (change directory) command • UNIX refers to a path as either: • Absolute - begins at the root level and lists all subdirectories to the destination file • Relative - begins at your current working directory and proceeds from there

  35. Listing Directory Contents The ls (list) command displays a directory’s contents, including files and subdirectories

  36. Listing Directory Contents • ls options: • a include files with “.” • l long format • R recursively list subdirectories

  37. Listing Directory Contents

  38. Managing Directories and Files • mkdir (make directory) command • Create a new directory • rmdir (make directory) command • Delete an empty directory • cp (copy) command • Copy files from one director to another • rm (remove) command • Delete files

  39. Setting File Permissions

  40. Setting File Permissions

  41. Setting File Permissionsfor Security • chmod command • To set file permissions • Settings are read (r), write (w), execute (x) • The three types of users are owners, groups, and others • Setting permissions to directories • Use the execute (x) to grant access

  42. Using Input and Error Redirection • You can use redirection operators to retrieve input from something other than the standard input device and send output to something other than the standard output device • Examples of redirection: • Redirect the ls command output to a file, instead of to the monitor (or screen) • Redirect a program that receives input from the keyboard to receive input from a file instead • Redirect error messages to files, instead of to the screen by default

  43. Redirecting Output • The greater than sign (>) is called a redirection symbol • Create a new file or overwrite an existing file by attaching (>) to a command that produces output • To append to an existing file, use two redirection symbols (>>)

  44. Creating new files • using cat output redirection • concatenate text via output redirection • touch command on new file • invoke editor for new file

  45. Manipulating Files • Delete files when you no longer needed • rm command • permanently removes a file or an empty directory • -r option removes a directory and everything it contains • Copy files as a means of back-up or as a means to assist with new file creation • cp command • copies the file(s) specified by the source path to the location specified by the destination path

  46. Manipulating Files • Moving a file • mv command • removes file from one directory and places it in another • Finding a file helps you locate it in the directory structure • find command • searches for the file that has the name you specify

  47. Manipulating Files • Combining files using output redirection • cat command • concatenate text of two different files via output redirection • paste command • joins text of different files in side by side fashion • Extracting fields of a file using output redirection • cut command • removes specific columns or fields from a file

More Related