Unix Shells.

Slides:



Advertisements
Similar presentations
UNIX Overview. 2 UNIX UNIX is a multi-user and multi-tasking operating system. Multi-tasking: Multiple processes can run concurrently. Example: different.
Advertisements

RH030 Linux Computing Essentials
Tony Kombol.  A program that  receives commands from a text input device (e.g. keyboard)  passes them to the operating system to perform  In the.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Chapter One The Essence of UNIX.
Processes and Job Control. Foreground and Background (1)  Unix is a multi-tasking operating system –some of these tasks are being done by other users.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen.
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.
UNIX Utilities Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn Input/Output.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 4P. 1Winter Quarter Introduction to UNIX.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
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.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
UNIX Unbounded 5th Edition Amir Afzal Chapter 3 Getting Started
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
CENT 305 Information Systems Security Linux Introduction.
Unix Background SEN 910 CSS/HTML Programming. 2 Brief Unix History In 1969, Ken Thompson at AT&T Bell Labs began developing Unix. First done in assembly.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Chapter 2: Getting Started Logon to Logout. In this chapter … Logging on The Shell Superuser Getting Help Logging off.
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Introduction to Programming Using C An Introduction to Operating Systems.
Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
THE UNIX SYSTEM Jan Recitation 2 Introduction to Networking.
Unix Advanced Shells Chapter 10. Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses,
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
A “Quick-Start” into the UNIX Operating System
Unix Scripting Session 1 March 6, 2008.
Getting started with CentOS Linux
Linux Command Basics I Tony Kombol.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Some Linux Commands.
Guide To UNIX Using Linux Third Edition
CSE 374 Programming Concepts & Tools
Shell Environments.
Chapter 3 Software Interfaces.
Chapter 1 The Essence of UNIX and Linux
Basic UNIX OLC Training.
CSE 390a Lecture 1 introduction to Linux/Unix environment
Chapter Four UNIX File Processing.
Getting started with CentOS Linux
Shell Programming.
Linux Shell Script Programming
Linux Professor Sabol.
CSE 303 Concepts and Tools for Software Development
UNIX and Shell Programming (06CS36)
UNIX and Shell Programming (06CS36)
Presentation transcript:

Unix Shells

Unix Shells Command Line Interpreter A High-Level Programming Language once logged in, login gives control to a shell it prompts for input, then parses, interprets, finds and executes the commands you type similar to Windows “Command Prompt”, but more sophisticated and more user friendly A High-Level Programming Language shell script is a program contains a series of commands you can let the system perform those commands by typing the file name of the script similar to .BAT batch files under MS-DOS, but again much more sophisticated

Shells vs. Graphical User Interfaces (GUIs) GUIs are more friendly to beginners lead you by the hand “point and click” interface requires little experience Shells are often better for experienced users shells tend to be faster, more efficient, and flexible fewer steps to do things do not need to change input devices (keyboard vs. mouse and keyboard) but, you must know command names and syntax Most modern Unix systems offer both a GUI and a Shell interface

Unix Shells Many shells to choose from ... sh: The Bourne Shell the original Unix shell S.R. Bourne designed it at Bell Labs not very "user friendly”, but good for programming sh or a reasonable facsimile comes packaged with virtually every Unix system csh: The C-shell a shell whose syntax is more “C”-like command history and job control make it very popular as a CLI comes with most Unix systems

Unix Shells tcsh: The T C-Shell bash: The Bourne Again Shell updated C-shell with better “line-editing”, access to command history, and command and file name completion default shell on GAUL bash: The Bourne Again Shell aimed at providing a public domain version of the Bourne shell default shell for Linux implemented as a part of GNU project by public efforts ksh, zsh, tsh, ...

Changing Your Shell Default shell is the shell you are given after you login to the system Changing your shell ... Your default shell can be changed using the “chsh” command on Unix. More on this later By typing “sh”, “csh”, “tcsh”, “bash”, etc. Run another type of shell as a “subshell” After you exit from the subshell, you will come back to the old one Your default shell is unchanged

Which Shell(s) Do We Teach? For the CLI aspects of the shell, we teach tcsh For programming language aspects, we teach sh Many Unix users use shells in this way Many features of sh or tcsh are shared by other shells e.g. tcsh is really an extension of csh, with some extra features

Issuing Commands Unix shells issues a prompt for input A typical prompt looks like: Editing input: using arrow keys to move the cursor using BackSpace or DEL or Ctrl-H to erase a letter using Ctrl-U to erase the whole line. obelix[1]> Separator Machine name History number

Issuing Commands A command is typically a program saved in the Unix file system, or part of the shell. type the name of the program, press <return> shell searches for the program and runs it Most commands take arguments Operands: file names, numbers, etc. obelix[2] > cat myfile obelix[3] > expr 1 + 3 Options: immediately following a ‘-’ or ‘+’ obelix[4] > cat -n myfile obelix[5] > ls -al display file "myfile" display file "myfile" with line numbers

Issuing Commands Stopping and pausing processes Control-c : terminate current process now Sends SIGINT signal to the process. Default setting of receiving a SIGINT is to quit. Control-\ : terminate current process now Send SIGQUIT signal to the process. A core file is usually generated. Control-z : Pause command now Can be restarted using the fg or bg commands More on this useful keystroke later. kill: Kill a process. More on this useful command later.

Common Commands (1) cp for CoPy rm for ReMove mv for MoVe Use: obelix[4] > cp file1 file2 Action: copy file1 into file2 rm for ReMove Use: obelix[5] > rm file2 Action: removes or deletes file2 mv for MoVe Use: obelix[6] > mv file1 file3 Action: renames file1 as file3 Compare: cp file1 file3; rm file1

Common Commands (2) cat for listing the contents of a file Use: obelix[7] > cat file1 Results: display the contents of file1 Why “cat”? originally “short” for concatenate can use: obelix[8] > cat file1 file2 prints file1 followed by file2 more for listing the contents of a file, one screen full at a time Use: obelix[9] > more file1 Results: display the contents of file1 for a page and pause. Press return for next line. Press space bar to see next page, b to go back one page. Press q to quit.

Common Commands (3) date what date and time is it? Use: obelix[10] > date Result: print the time and date cal print a calendar Use: obelix[11] > cal Result: print the calendar of the month hostname what machine am I on? Use: obelix[12] > hostname Result: print the machine's name who who else is logged onto this computer? Use: obelix[13] > who Result: a list of users and some info about them

Common Commands (4) uptime how long has the machine been up and running? Use: obelix[14] > uptime Result: one line with all sorts of neat stuff netscape surf the net Use: obelix[15] > netscape Result: web surfing software that works only under X-windows lynx surf the net Use: obelix[16] > lynx Result: web surfing software that is text-only

Common Commands (5) echo: print some text expr: evaluate an expression Use: obelix[17] > echo Unix is easy! Result: Unix is easy! expr: evaluate an expression Use: obelix[18] > expr 1 + 2 Result: 3 clear: clear screen Use: obelix[19] > clear Action: clears the screen

Using man man: View manual pages Use: obelix[20] > man subject Action: Displays the man page for subject e.g. “man cat” produces the following:

Important Parts of Manual Pages Name The name of the command and brief description Synopsis A brief overview on how to use the command Description More details of what the command does Options and Operands Arguments given to the command Examples See Also Related commands

More of man man -k keyword man man man -s n subject list all the commands whose brief description (in the “name” field) contains the keyword the apropos command does the same thing as executing man -k man man print out the manual of the command man man -s n subject prints man page for subject from section n man pages are organized into several sections: Commands, C reference, File formats, … man -l subject will list all of the sections containing the subject … a man -s will then find the man page

Alternatives to man xman info answerbook http://docs.sun.com/ An X-windows interface to man pages Better browsing and searching facilities info A hypertext interface to accessing manuals for GNU software (gcc, emacs, info, …) answerbook Newer manual pages from Sun in HTML Also at: http://asterix.gaul.csd.uwo.ca:8888 http://docs.sun.com/ Complete set of manuals from Sun

Electronic Mail (1) We assume you are familiar with e-mail Your e-mail address: Your e-mail address is made up of two parts Your user name. Generally your login name on GAUL. Your domain name. A collection of users, typically connected to a particular collection of computers Your e-mail address will be something like bill@gaul.csd.uwo.ca gaul.csd.uwo.ca is the "domain name“ for all of the machines in the Undergrad lab

Electronic Mail (2) There’s a very wide choice of mail programs mail the “default” mailer has a command-line interface with lots of commands elm this is a visual, partially menu-driven mailer complete, flexible and easy to use requires that you know the “vi” or “emacs” editor pine the simplest mailer “noisy” menu-driven interface, but quite complete use it if you are unsure of yourself...it does the job

Exercise Use ps to see which shell you are using. Change your shell to another by sh, csh, or tcsh Use ps again to see how many shells are running; explain why.