Why UNIX? In the 1980s, UNIX became popular In the 1980s, UNIX became popular Customer demand for open systems: Customer demand for open systems: Application.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
Chin-Chih Chang CS 497C – Introduction to UNIX Lecture 28: - Filters Using Regular Expressions – grep and sed Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Linux+ Guide to Linux Certification, Second Edition
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Filters using Regular Expressions grep: Searching a Pattern.
What is Unix Prepared by Dr. Bahjat Qazzaz. What is Unix UNIX is a computer operating system. An operating system is the program that – controls all the.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Advanced File Processing
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Guide To UNIX Using Linux Fourth Edition
Linux+ Guide to Linux Certification Chapter Four Exploring Linux Filesystems.
Linux+ Guide to Linux Certification, Third Edition
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
The Shell Chapter 7. Overview The Command Line Standard IO Redirection Pipes Running a Program in the Background Killing (a process!)
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
I/O Redirection and Regular Expressions February 9 th, 2004 Class Meeting 4.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Administration Utilities Objectives –to use standard administration utilities Contents –manual pages –identifying your system –communicating with Users.
UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.
40 Years and Still Rocking the Terminal!
I/O Redirection & Regular Expressions CS 2204 Class meeting 4 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
1 Lecture 9 Shell Programming – Command substitution Regular expressions and grep Use of exit, for loop and expr commands COP 3353 Introduction to UNIX.
By Corey Stokes 9/14/10. What is grep? Global Regular Expression Print grep is a command line search utility in Unix Try: Search for a word in a.cpp file.
BASH – Text Processing Utilities Erick, Joan © Sekolah Tinggi Teknik Surabaya 1.
UNIX Commands RTFM: grep(1), egrep(1) & fgrep(1) Gilbert Detillieux April 13, 2010 MUUG Meeting.
Basic UNIX Concepts. Why We Need an Operating System (OS) OS interacts with hardware and manages programs. A safe environment for programs to run is required.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Linux+ Guide to Linux Certification, Second Edition
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
FILTERS USING REGULAR EXPRESSIONS – grep and sed.
Lesson 6-Using Utilities to Accomplish Complex Tasks.
Learning Unix/Linux Based on slides from: Eric Bishop.
Filters and Utilities. Notes: This is a simple overview of the filtering capability Some of these commands are very powerful ▫Only showing some of the.
UNIX  Portable (common to many computer architectures), multitasking, multi-user operating system  Introduced by Bell labs in mid-1960’s  Thus, much.
PROGRAMMING THE BASH SHELL PART III by İlker Korkmaz and Kaya Oğuz
Linux 201 Training Module Linux Adv File Mgmt.
Tutorial of Unix Command & shell scriptS 5027
Lesson 5-Exploring Utilities
LECTURE 03: The Bash Command Line
Advanced File Processing
Some Linux Commands.
Lecture 9 Shell Programming – Command substitution
Unix Scripting Session 4 March 27, 2008.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Guide To UNIX Using Linux Third Edition
Tutorial of Unix Command & shell scriptS 5027
Chin-Chih Chang CS 497C – Introduction to UNIX Lecture 28: - Filters Using Regular Expressions – grep and sed Chin-Chih Chang
Tutorial Unix Command & Makefile CIS 5027
Linux Shell Script Programming
Lab 5: Complex Inputs.
LPI Linux Certification
Presentation transcript:

Why UNIX? In the 1980s, UNIX became popular In the 1980s, UNIX became popular Customer demand for open systems: Customer demand for open systems: Application portability Application portability Vendor independence Vendor independence User portability User portability Time to market considerations Time to market considerations Major vendors (such as Sun, DEC, HP, IBM) implemented UNIX based product lines. Major vendors (such as Sun, DEC, HP, IBM) implemented UNIX based product lines.

Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering System II in early 80s AT&T began offering System II in early 80s Linux Linux defined in 1991 defined in 1991 Red Hat, 1995 Red Hat,

UNIX Philosophy Simplicity Simplicity Reusability Reusability Filters Filters Open Formats Open Formats Flexibility Flexibility

What is the shell? Utility program loaded when a user logs in init getty login sh (bash) startup

Shell’s Responsibilities Shell Program Execution variable and filename substitution I/O Redirection pipeline hookup environment control interpreted programming languages

Shell Substitutions Certain characters are interpreted by the various Unix shells as “wildcards” for filenames, also known as metacharacters Certain characters are interpreted by the various Unix shells as “wildcards” for filenames, also known as metacharacters * - mathes 0 or more of any character ls *.c ? - matches any single character ls file0?.c [...] - matches any single character if it is in the list provided ls file[0-9].c

Regular Expressions A formalized way to specify strings A formalized way to specify strings File names (shell commands) File names (shell commands) Strings in text files (during editing) Strings in text files (during editing) Compilers (future topic) Compilers (future topic) Sed Sed Unfortunately, each use defines its own special metacharacters Unfortunately, each use defines its own special metacharacters

Regular Expressions LS – which files match A*[0-9]?.c LS – which files match A*[0-9]?.c AboutTime.c AboutTime.c AboutTime AboutTime A2.c A2.c A2i.c A2i.c A211x.c A211x.c AllFilesGreaterThan12.c AllFilesGreaterThan12.c A2char.c A2char.c

Regular Expressions Write a regular expressions for: Write a regular expressions for: All files with an ‘X’ in the name All files with an ‘X’ in the name All files with an ‘X’ and a following ‘Y’ All files with an ‘X’ and a following ‘Y’ All file names with exactly 6 characters All file names with exactly 6 characters All file names with more than 6 characters All file names with more than 6 characters All files that start with ‘a’ and end with ‘x’ All files that start with ‘a’ and end with ‘x’ All files names including an ‘a’ but fewer than 10 characters (this one is TOUGH!) All files names including an ‘a’ but fewer than 10 characters (this one is TOUGH!)

The Manual The man command The man command man gcc man gcc Spacebar for next page and return for next line Spacebar for next page and return for next line q to quit q to quit Also try info Also try info info gcc info gcc

grep Commands grep, egrep, fgrep grep, egrep, fgrep grep format: grep format: grep [options] search_string filename(s) grep [options] search_string filename(s) Options: Options: -cPrints the count of matching lines rather than the actual lines -cPrints the count of matching lines rather than the actual lines -lprints the name of each file containing matching lines, rather than the actual lines -lprints the name of each file containing matching lines, rather than the actual lines -nprecedes each line with a line number -nprecedes each line with a line number -vinverse search, shows all lines that do not match pattern -vinverse search, shows all lines that do not match pattern

sort Command sort format: sort format: sort [options] filename sort [options] filename Options: Options: -dalphabetic, ignore punctuation -dalphabetic, ignore punctuation -fignore case for sorting -fignore case for sorting -rreverse sort order -rreverse sort order -o outfile output to file, not stdout -o outfile output to file, not stdout -narithmetic order -narithmetic order -tcuse ‘c’ to separate fields; default is whitespace -tcuse ‘c’ to separate fields; default is whitespace

find Command find format: find format: find directory_name search_criteria action find directory_name search_criteria action Search Criteria: Search Criteria: name filenamefiles that match filename name filenamefiles that match filename atime +-nfiles last accessed in days atime +-nfiles last accessed in days mtime +-nfiles last modified in days mtime +-nfiles last modified in days followfollow symbolic links followfollow symbolic links

find Command Actions: Actions: -printprint the files found -exec cmdexecute command on files found -ok cmdlike exec, but prompts to execute command first