UNIX/LINUX Shells Shell is an UNIX/LINUX command interpreter. Shell command can be internal or external. The code to execute an internal command is part.

Slides:



Advertisements
Similar presentations
Chapter 9: The TC Shell Everything you thought you knew is now wrong.
Advertisements

Lecture 2 Shell environment I: - command line interface & basic commands; - directories & files; - standard I/O & file descriptors; CSE4251 The Unix Programming.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
UNIX chapter 04 UNIX Shells Mr. Mohammad Smirat. Introduction The shell is the software that listens to commands typed in at the terminal and translates.
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 36: - Customizing the Environment Chin-Chih Chang
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
Using Linux Commands 2 Lab#5
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 Linux Commands 2 Lab#5. Sort command Sort the lines of text files. $ sort fileName by default it will sort in normal order(alphabetical 0-9 A-Z.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
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.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Shell The Shell The agency that.
Unix Shells Based on Glass & Abels’ Book CS240 Computer Science II.
Shells. A program that is an interface between a user at a terminal and the computers resouces ▫The terminal may be real or an emulator The shell is.
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!)
Linux+ Guide to Linux Certification, Third Edition
Linux Operations and Administration
Keyword Shell Variables The shell sets keyword shell variables. You can use (and change) them. HOME The path to your home directory PATH Directories where.
Basic Shell Scripting - Part 1 Objective - Learn to: Read Start-up Files Edit Start-up Files Modify Your User Environment Communicate with Users Write.
1 Homework / Exam HW7 is due next class Starting Glass chapter 4 and parts of 7 Exam 3 – Class 26 –Open Book / Open Notes –Up through End of K&R Chapter.
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.
Workbook 6 – Part 2 The Bash Shell
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Chapter 0 A “Quick-Start” into the UNIX Operating System.
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.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Chapter 4 LINUX Shells. Table 4.1 Shell Locations and Program Names.
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.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
1 Day 18 Bash and the.files. 2 The.files ls shows you the files in your directory –Or at least most of them. –Some files are hidden. Try: ls –a –This.
Compunet Corporation Introduction to Unix (CA263) Your Environment By Tariq Ibn Aziz Dammam Community College.
CSCI 330 UNIX and Network Programming Unit III Shell, Part 1.
Jozef Goetz, expanded by Jozef Goetz, 2006 Credits: Parts of the slides are based on slides created by textbook authors, Syed M. Sarwar, Robert.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Linux+ Guide to Linux Certification, Second Edition
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
Configuration your environment Many user-configurable Unix programs (such as your shell) read configuration files when they start up. These configuration.
Linux Administration Working with the BASH Shell.
Agenda Customizing a Unix/Linux account Environment Introduction to Start-up Files (.bash_profile,.bashrc,.profile,.kshrc) Safe Methods for Changing Start-up.
A “Quick-Start” into the UNIX Operating System
SUSE Linux Enterprise Desktop Administration
Andy Wang Object Oriented Programming in C++ COP 3330
System Programming and administration CS 308
Some Linux Commands.
Shell Environments.
UNIX and Shell Programming (06CS36)
CSC 140: Introduction to IT
(Chapter 2) John Carelli, Instructor Kutztown University
CSCI The UNIX System Shell Startup and Variables
The Linux Command Line Chapter 11
Introduction Paul Flynn
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
Chapter 3 The UNIX Shells
The Linux Command Line Chapter 11
Presentation transcript:

UNIX/LINUX Shells Shell is an UNIX/LINUX command interpreter. Shell command can be internal or external. The code to execute an internal command is part of the shell processes. (Ch. 13) The code to process an external command resides in a file in the form of a binary executable program file or a shell script.

UNIX/LINUX Shells Shell executes command entered from the keyboard. By pressing at the beginning of a new line, shell terminates. Shell assumes the first word in a command line is the name of the command. Shell assumes any of the remaining word starting with a hyphen (-) are options and that the rest of them are the command arguments.

UNIX/LINUX Shells How shell command are processed? 1.Read your command line. 2.Determines whether the command is an internal or external command. 3.Process all internal command by using corresponding code segment that are within its own code. (See Ch. 13 for commands) 4.Execute an external command by searching directories in the file system structure, looking for a file that has the name of the command. (See Ch. 7 for commands)

UNIX/LINUX Shells Shell process all internal commands by using the corresponding code that are within its own code. Shell searches several directories in the file system structure, looking for a file that has the name of the command. Shell variable: PATH (or path in the TC shell) search path echo $PATH ( Bash ); echo $path ( TC Shell )

UNIX/LINUX Shells Common Shells and their locations

Figure 4.1 Shell families and their relative functionalities

UNIX/LINUX Shells login shell: (your default shell)  When you log on, one particular type of shell starts execution. Change your default shell:  1: Ask your system administrator  2: Using shell command such as chsh.

UNIX/LINUX Shells Three ways to change your shell.  1) by changing to a new default shell for every subsequent login session.  2) by creating additional shell sessions running on top of, or concurrent with, the default shell.  3) by changing your shell for only the current login session.

UNIX/LINUX Shells 1) Change to a new default shell. To find out which shell you're currently using, enter:  echo $SHELL To see a list of available shells, enter:  cat /etc/shells On computers running Linux, enter:  chsh –s newshell (Your password might be asked.)  Replace newshell with the full pathname of the shell you want to use. Enter your password when prompted, and the system will change your shell.  e.g. chsh newshell (Solaris)  e.g. chsh username newshell (HP-UX)  e.g. chsh (AIX, Tru64)

UNIX/LINUX Shells 2) Create additional shell to run at the same time as your default shell. $ echo $SHELL /bin/bash $ tcsh % ps PIDTTYTIMECMD 1025pts/000:00:00bash 1041pts/000:00:00tcsh 1048pts/000:00:00ps

UNIX/LINUX Shells 3) Change your shell by using the exec command (for only the current login session) For eaxmple, if you have determined that your current shell is Bash and you want to change to the TC shell, simply type: exec /bin/csh

Shell Similarities and Disimilarities (continued on next slide)

Shell Similarities and Disimilarities (continued from previous slide)

Shell Start-Up Files and Environment Variables Each Linux system has an initial system start-up file, usually in /etc/profile. (Initial settings of important environment variables for shell and some other utilities) Shell start-up files (When you start a shell) are in a user’s home directory as ~/.profile or in a particular shell’s profile or login file in each user’s home directory. dot files or hidden files

Shell Startup Files for Bash and TC Shells

Shell Environment Variables

Creating and Displaying Directories (; separates commands) pwd mkdir tmp; rmdir tmp; rm –rf (3 commands) ls; ls –l; ls –C; ls –ac; ls –last (5 comamnds) ls –C linuxbook/examples (1 command) cd; cd ~teng; cd ~; (3 commands)

Displaying files cat file_name more file_name (one a time) more sample phones (one a time for both files; The contents of the sample file displays first.) pg file_name (The pg command is similar to the more command.)

Printing Files lpr is the off-line printer... (BSD, SUN) lp is just a frontend to the lpr. (System V) lpr –P printer1 sample (-P: printer device) lpr –P spr –n 3 sample (-n: number of copies) lp –d printer1 sample (-d: printer device)

Create Pseudonyms for Commands alias [ name [=string]…]Bash shell alias [ name [string]]TC shell Command aliases can be placed in a system start-up file, the ~/.profile or the /.login file. Usually they are placed in a shell start-up file; the.bashrc file (Bash) and the.cshrc file (TC shell) The ~/.profile or ~/.login file executes when you log on. The ~/.cshrc or ~/.bashrc file executes every time you start Tcsh or Bash.

Some Useful Aliases $ unalias ls $ alias

Some Useful Aliases $ unalias –a $ alias $

Shell Metacharacters (continued on next slide)

Shell Metacharacters (continued from previous slide)