1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.

Slides:



Advertisements
Similar presentations
June 1, 1999Foreground/Background Processing1 Introduction to UNIX H. Foreground/Background Processing.
Advertisements

CIS 118 – Intro to UNIX Shells 1. 2 What is a shell? Bourne shell – Developed by Steve Bourne at AT&T Korn shell – Developed by David Korn at AT&T C-shell.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 4: More Command Line Interface (CLI) Chapter 7: The Linux Shell By Fred R. McClurg Linux.
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.
Introduction to Unix – CS 21 Lecture 10. Lecture Overview Midterm questions Jobs and processes description The foreground and background Controlling jobs.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
1 Introduction to UNIX Ke Liu
1 © 2001 John Urrutia. All rights reserved. Chapter 5 The Shell Overview.
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
Linux+ Guide to Linux Certification, Second Edition
Shell Basics CS465 - Unix. Shell Basics Shells provide: –Command interpretation –Multiple commands on a single line –Expansion of wildcard filenames –Redirection.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
1 UNIX essentials (hands-on) the directory tree running programs the shell (using the T-shell) → command line processing → special characters → command.
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.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Introduction to Shell Script Programming
Linux in More Detail Shirley Moore CPS5401 August 29,
UNIX Unbounded 5th Edition Amir Afzal Chapter 3 Getting Started
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
An Introduction to UNIX System --- Cosc513 Presentation n Instructor: Morteza Anvari n Author: Yonghong Pan n ID#: n Date: Jan.29, 2001.
An Introduction to Unix Shell Scripting
Shell Features CSCI N321 – System and Network Administration Copyright © 2000, 2005 by Scott Orr and the Trustees of Indiana University.
Hp education services education.hp.com hp education services education.hp.com 1 HP World/Interex 2002 Linux BASH Shell Programming Chris Cooper (734)
CS 2061 Shells Also known as: Unix Command Interpreter.
Chapter 2: Getting Started Logon to Logout. In this chapter … Logging on The Shell Superuser Getting Help Logging off.
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
The Shell Chapter 7. Overview The Command Line Standard IO Redirection Pipes Running a Program in the Background Killing (a process!)
July 17, 2003Serguei A. Mokhov, 1 Shells and Shell Scripts COMP 444/5201 Revision 1.3 January 25, 2005.
1 UNIX essentials (hands-on) the directory tree running programs the shell → command line processing → special characters → command types → shell variables.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Pipes and Redirection in Linux ASFA Programming III C. Yarbrough.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
1 Unix Seminar #1 T.J. Borrelli Lecturer for CS and NSSA February 6th, 2009.
Hands On UNIX II Dorcas Muthoni. Processes A running instance of a program is called a "process" Identified by a numeric process id (pid)‏  unique while.
1 Advanced Unix Commands How Unix works along with some additional, useful Unix commands you might like to know.
Unix Shell Environments February 23rd, 2004 Class Meeting 6.
UNIX shell environments CS 2204 Class meeting 6 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Chapter Six Introduction to Shell Script Programming.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Chapter 5: The Shell The Man in the Middle. In this chapter … The command line Input, output, and redirection Process management Wildcards and expansion.
Module 1 - Introduction to Linux. Users must log-in Linux is case sensitive File and Directories naming conventions (No spaces!) Files and Directories.
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+ Guide to Linux Certification, Second Edition
Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
An Introduction to processes R Bigelow. A Unix Process A process in Unix is simple a program The Unix system is made up of a group of processes all interacting.
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
Linux Administration Working with the BASH Shell.
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
Introduction to Shells
Shell Features CSCI N321 – System and Network Administration
Unix Shells.
An Introduction to UNIX System --- Cosc513 Presentation
John Carelli, Instructor Kutztown University
Linux Shell Script Programming
Unix Shell Environments
Chapter 3 The UNIX Shells
LPI Linux Certification
Presentation transcript:

1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need to know.

2 UNIX Consistency The version of the UNIX kernel that is used on a machine is determined by the architecture of the hardware. Many of the same shells are found across all the versions of UNIX. All the versions of UNIX “seem” to be the same due to the identical interface.

3Shells Bourne shell ( sh ) – Only shell guaranteed to be on every version of UNIX – Probably the fastest shell due to its lack of features C - shell ( csh ) – Uses C programming like syntax, but lacks a strong I/O component which makes scripting hard. Korn shell ( ksh ) – Combines functionality of C-shell with the scripting strength of Bourne shell. T – Shell ( tcsh ) – Much better interface than C shell, but not uniformly available across all UNIX. Is on miller / grid bash is also a popular shell

4 Shell Commands Command line UNIX is the most powerful interface, but the most difficult to master. Commands follow a general format: – command [-options] [arguments] – “command” – this is the actual command that you are sending to the shell to be executed. – [-options] – Options are also referred to as ‘flags’. They are usually preceded with a minus sign (-) Options modify the functionality of a command. – [arguments] – Used to tell the command what to work with or what to work upon. The spaces allow for the shell to parse the command.

5 How the shell works Shell displays a prompt. – Example for miller: miller.cs: – Example for alpha: ( alpha ) n: where n is the number of commands so far. You type in a command. You press the return key. The shell interprets the commands you typed and tries to find the correct programs to run. The kernel runs the requested programs and returns the results to the shell. The shell displays the command prompt again.

6 Changing The Shell You can switch between which shell your using relatively easy. – On miller / grid Simply type the shell that you want to use. Example: miller.cs: tcsh – On alpha: use the ‘chsh’ command: Example: (alpha) 1: chsh Changing shell for SampleUser. Old shell: /usr/local/bin/tcsh New shell: csh

7 Standard Input, Output and Error Standard input – stdin – The place the program normally looks for input. – The keyboard. Standard output – stdout – The place where the program normally sends its output. – The screen. Standard error – stderr – Used by programs to display error messages. – Also the screen.

8 Grouping commands Executing one command at at time can be tedious. Unix allows for grouping of commands by separating commands with a semi-colon (;). – Example: miller.cs: pwd; cal ; date

9 | (pipe) Used to link commands. – [command] | [command] etc. The output of the first command is sent as the input to the second command, and so on, and so on … – Example: miller.cs: who | more

10 Wildcards Typing in Unix can be tedious. Unix supports three wild-card characters: – Asterisk (*): matches any string of characters including blanks. – Question mark (?): matches single characters. – Square brackets ([]): Tells the shell to match any characters that appear inside the brackets.

11 Job control Unix works via jobs or processes. Every command or program is a separate process executed by a user. Processes are usually run in the foreground, but can be made to run in the background. Processes can be killed by the user who created them.

12 Job control ctrl-c: cancels a command/job – Good for breaking out of infinite loops! ctrl-z: suspends a command/job ‘ps’ displays the status of current processes – Example: miller.cs: ps PID TT S TIME COMMAND 3979 pts/131 S 0:00 -csh 5629 pts/131 S 0:00 tcsh

13 bg Forces a process to the background. First, type a ctrl-z to suspend the process. Then type bg and the process is forced to the background. Use the ps command to see it. You can force a process to the background immediately with the &.

14 fg Brings a process to the foreground. Use the ps command to see the processes you have running. Type fg %[number] and that process will be brought to the foreground.

15 kill Kills a process that you have running. Use the ps command to see what you have running. Type kill [number]. Not the most graceful way out, but it works.