UNIX and Shell Programming (06CS36)

Slides:



Advertisements
Similar presentations
CS 497C – Introduction to UNIX Lecture 5: Understanding the UNIX Command Chin-Chih Chang
Advertisements

Unix. Outline Commands Environment Variables Basic Commands CommandMeaning lslist files and directories ls -alist all files and directories mkdirmake.
Chapter 4 Getting Help. Using CDE Help Help Manager – primary help tool SunSolve Online – Web-based online help from Sun Solaris Support – Web-based Sun.
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 20: - The Shell Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 4: Understanding the UNIX Command Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Basic Unix Dr Tim Cutts Team Leader Systems Support Group Infrastructure Management Team.
UNIX Overview. 2 UNIX UNIX is a multi-user and multi-tasking operating system. Multi-tasking: Multiple processes can run concurrently. Multi-user: different.
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.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
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.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Introduction to Linux ( I ) Sidney Fong 4 th Feb 2006.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Chapter Eight Exploring the UNIX Utilities. 2 Lesson A Using the UNIX Utilities.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
Linux+ Guide to Linux Certification, Third Edition
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #4  Unix software architecture  Correcting mistakes  System setups  Useful commands for the beginner.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Chapter Three The UNIX Editors.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
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.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Introduction to UNIX CS 2204 Class meeting 1 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Chapter Eight Exploring the UNIX Utilities. 2 Lesson A Using the UNIX Utilities.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Overview of Linux Fall 2016 Dr. Donghyun Kim
A LECTURE NOTE.
Introduction to UNIX.
Lesson 5-Exploring Utilities
SUSE Linux Enterprise Desktop Administration
Introduction to Shells
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Unix Shells.
Some Linux Commands.
C151 Multi-User Operating Systems
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Guide To UNIX Using Linux Third Edition
The Unix Operating System
Unix Operating System (Week Two)
CSE 374 Programming Concepts & Tools
UNIX and Shell Programming (06CS36)
Basic UNIX OLC Training.
(Chapter 2) John Carelli, Instructor Kutztown University
Unix : Introduction and Commands
CSCI The UNIX System Shell Startup and Variables
Chapter Four UNIX File Processing.
Introduction Paul Flynn
Linux Shell Script Programming
Module 5 Getting Help.
UNIX and Shell Programming (06CS36)
Chapter 3 The UNIX Shells
Module 06 Getting Help.
Presentation transcript:

UNIX and Shell Programming (06CS36) Unit 1Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of Technology, Belgaum. INDIA. mangalwede@yahoo.com

Agenda Feature of UNIX A Brief History of UNIX Command Structure and Usage man Pages Further help with man –k, apropos and whatis Troubleshooting terminal issues

Features of UNIX Multiuser System Multitasking System The Building Block Approach The UNIX Toolkit Pattern Matching Programming Facility Documentation

A Brief History of UNIX Multics Unics UNIX V1 UNIX V3 UNIX V4 UNIX V7 1965 1969 1970 1973 1979 BSD UNIX AT&T UNIX BSD 4.1 BSD 4.2 BSD 4.4 1981 1983 1993 System III System V 1982 1984 Multiple Standards AT&T – System V Interface Definition X/OPEN – X/OPEN Portability Guide (XPG) IEEE – Portable Operating System Interface for Computing Environments (POSIX) 1998 – X/OPEN & IEEE started work to merge two standards 2001 – Single UNIX Specification Version 3 (SUSV3) Also known as IEEE1003.1:2001 2002 – ISO standardized SUSV3 and IEEE1003.1:2001

Command Structure A UNIX command is an action request given to the UNIX shell for execution. All UNIX commands apply an action or a series of actions to some input data and create some output data. All UNIX commands are case sensitive. The command format is $ verb [options] [arguments] where verb is the command name options modify how the action is applied and arguments provide additional information to the command There are a few commands (like pwd) that don’t take any arguments, some commands (like who, ls) that may or may not take any arguments and some commands (like cut) that compulsorily take arguments.

Internal and External Commands The commands that are built-in as part of the shell are called internal commands. Example: echo command A program or file having an independent existence in the /bin directory (or /usr/bin), is called as an external command. Example: ls, wc, cal, bc, more … PATH variable: Contains the sequence of directories that the shell searches to look for a command. $ echo $PATH /bin:/usr/bin:/usr/local/bin:/usr/local/java/bin:. When you issue a command, The shell sees if it is a built-in command. If so, it executes it directly. If not a built-in, it searches the associated file in the directories specified in PATH. If found, it executes the file. Otherwise, it triggers a error message.

Flexibility of Command Usage A command can often be entered in more than one way. If used judiciously, you can restrict the number of keystrokes to a minimum. Examples: Combining Commands $ wc chap1 ; ls –l chap1 Command line that overflows $ echo “This is > a three line > text message” UNIX lets you type commands without waiting for a prompt; The commands are passed onto the shell for interpretation after the previous command has completed.

man pages UNIX offers an online help facility in the man command. man displays the documentation of the specified command. Example: $ man wc displays help on wc command man uses a pager program, which displays this documentation one page at a time man is configured to be used with a specific pager. Two available pagers are: more, a Berkeley pager, as an alternative to the AT&T pg command less, the standard pager on Linux systems, also available on UNIX. It is modeled after vi editor and is more powerful than more..

A sample man Page User Commands wc(1) NAME wc – displays a count of lines, words and characters in a file SYNOPSIS wc [-c | -m | -C] [-lw] [file ...] DESCRIPTION The wc utility reads one or more input files and, by default, writes the number of newline characters, words and bytes contained in each input file to the standard output. The utility also writes a total count for all named files, if more than one input file is specified. OPTIONS The following options are supported: -c Count bytes. -m Count characters. -C same as –m. -l Count lines. -w Count words delimited by white spaces or new line characters ... OPERANDS The following operand is supported: file A path name of an input file. If no file operands are specified, the standard input will be used. EXIT STATUS See largefile(5) for the description of the behavior of wc when encountering files greater than or equal to 2 Gbyte (2 **31 bytes) SEE ALSO cksum(1), isspace(3C), iswalpha(3C), iswspace(3C), largefile(5), ...

Organization of man Documentation Section Subject (SVR4) Subject (Linux) 1 User programs 2 Kernel’s system calls 3 Library functions 4 Administrative file formats Special files (in /dev) 5 Miscellaneous 6 Games 7 Macro packages and conventions 8 Administration commands

Further help with man –k, apropos and whatis man –k: Searches a summary database and prints one-line description of the command. Example: $ man –k awk awk awk(1) -pattern scanning and processing language nawk nawk(1) -pattern scanning and processing language apropos: lists the commands and files associated with a keyword. Example: $ apropos FTP ftp ftp(1) -file transfer program ftpd in.ftpd(1m) -file transfer protocol server ftpusers ftpusers(4) -file listing users to be disallowed ftp login privileges whatis: lists one-liners for a command. Example: $ whatis cp cp cp(1) -copy files

When things go wrong Terminal settings directly impact keyboard operation, and you should know which keys to press when things don’t quite work as expected. Keystroke or command Function [Ctrl-h] Erases text [Ctrl-c] or Delete Interrupts a command [Ctrl-d] Terminates login session or a program that expects its input from keyboard [Ctrl-s] Stops scrolling of screen output and locks keyboard [Ctrl-q] Resumes scrolling of screen output and unlocks keyboard [Ctrl-u] Kills command line without executing it [Ctrl-\] Kills running program but creates a core file containing the memory image of the program [Ctrl-z] Suspends process and returns shell prompt; use fg to resume job [Ctrl-j] Alternative to [Enter] [[Ctrl-m] stty sane Restores terminal to normal status

End of Session