Topic 5 0
1 / 17

TOPIC 5.0 - PowerPoint PPT Presentation

  • Uploaded on

TOPIC 5.0. LINUX SHELLS. SHELL SCRIPT. Shell is the interface between end user and the Linux system , similar to the commands in Windows Typical operations performed by shell scripts include file manipulation, program execution, text printing. EXAMPLE OF A SHELL SCRIPT.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' TOPIC 5.0' - akina

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Topic 5 0




Shell script

  • Shell is the interface between end user and the Linux system, similar to the commands in Windows

  • Typical operations performed by shell scripts include

    • file manipulation,

    • program execution,

    • text printing.

Example of a shell script

  • Use text editor to generate the “first” file

    • #!/bin/sh

    • # first

    • # this file looks for the files containing POSIX

    • # and print it

    • for file in *

    • do

    • if grep –q POSIX $file

    • then

    • echo $file

    • fi

    • done

    • exit 0

  • % /bin/sh first

  • % chmod +x first

  • %./first

Importance of a shell script

  • easy program or file selection,

  • quick start, and interactive debugging.

  • A shell script can be used to provide a sequencing and decision-making linkage around existing programs

  • Non-expert users can use scripting to tailor the behaviour of programs.

Various of linux shells

  • Bourne shell (sh commands)

  • C shell (csh commands)

  • Bourne-Again shell (bash commands)

  • Korn shells (kshcommands)

  • Almquist shells (ash commands)

Bourne shell sh commands
BOURNE SHELL (sh commands)

  • The Bourne shell, or sh, was the default Unix shell of Unix Version 7,

  • It replaced the Thompson shell, but the executable file had the same name, sh.

  • It was developed by Stephen Bourne, and released in 1977 in the Version 7 Unix.

  • It remains a popular default shell for Unix accounts.

  • The binary program of the Bourne shell or a compatible program is located at /bin/shon most Unix systems

  • Its command interpreter contained all the features that are commonly considered to produce structured programs.

  • Although it is used as an interactive command interpreter, it was always intended as a scripting language.

C shell csh commands
C SHELL (csh commands)

  • The C shell is a Unix shell that was created by Bill Joy in the late 1970s.

  • It has been distributed widely in 1978.

  • The C shell is a command processor that's typically run in a text window, allowing the user to type commands which cause actions.

  • The C shell can also read commands from a file, called a script.

  • C shell has an interactive features and overall style.

  • Its new features made it easier and faster to use.

  • And the overall style of the language looked more like C and was seen as more readable.

Bourne again shell bash commands
BOURNE-AGAIN SHELL (bash commands)

  • Bash is the shell, or command language interpreter, that will appear in the GNU operating system.

  • Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh).

  • It offers functional improvements over sh for both programming and interactive use.

  • In addition, most sh scripts can be run by Bash without modification.

  • The manual is available online at

  • BASH can be downloaded at

Korn shell ksh commands
KORN SHELL (ksh commands)

  • The Korn shell (ksh) is a UNIX shell which was developed by David Korn in the early 1980s.

  • It is backwards-compatible with the Bourne shell but includes many features of the C shell as well, such as a command history

  • The main advantage of ksh over the traditional Unix shell is in its use as a programming language.

  • Several features were gradually added, while maintaining strong backwards compatibility with the Bourne shell.

Almquist shell ash commands
ALMQUIST SHELL (ash commands)

  • The Almquist shell (also known as A Shell, ash) was originally developed by Kenneth Almquist‘s

  • it is a fast, small, POSIX-compatible Unix shell designed to replace the Bourne shell in later BSD distributions.

  • Originally it did not feature line editingor command history mechanisms - should be moved into the terminal driver;

  • ash are installed as the default shell (/bin/sh) on FreeBSD, NetBSD, DragonFly BSD and Minix.

  • Debian's version of ash is known as DebianAlmquist Shell (dash).

Methods to get shell interface

  • Shell Prompts

    • It looks like an MS-DOS screen.

      • Users type commands at a shell prompt,

      • the shell interprets these commands,

      • and then the shell tells the OS what to do.

    • Linux functions can be completed faster from the shell prompt than from a GUI.

Methods to get shell interface1

  • Terminal Windows

    • synonymous with a command line shell or text terminal, the term terminal covers all remote terminals, including graphical interfaces.

    • A terminal emulator inside a GUI is often called as terminal window.

    • A terminal window allows the user access to Command Line Interfaces (CLI) and Text User Interface applications.

    • On Unix-like OS, it is common to have one or more terminal windows connected to the local machine.

Methods to get shell interface2

  • Virtual Terminal

    • In open systems, a virtual terminal (VT) is an application service that:

      • Allows host terminals on a multi-user network to interact with other hosts regardless of terminal type and characteristics,

      • Allows remote log-on by LAN managers for the purpose of management,

      • Allows users to access information from another host processor for transaction processing,

      • Serves as a backup facility.

    • ITU-T defines a virtual terminal protocol based on the OSI application layer protocols.

Linux text editor

  • vi editor

    • Vi is often the default editor that pops up when we're ready to write an e-mail message or when we're posting a News message. 

    • Vi is complicated and seems difficult to learn at first. 

    • it is often the default for Unix and Linux systems. 

  • pico (Pine composer) editor

    • Pico is a simple text editor that provides straight-forward options and easy-to-use commands. 

    • it provides everything necessary to write long documents with minimal hassles. 

    • Pico is not very good when manipulating certain types of files such as making changes to .cgifiles

Linux text editor1

  • emacs (Editor Macros) editor

    • Emacs falls somewhere between the straightforward Pico and the complicated Vi. 

    • Unlike Vi, we don't need to switch between modes to perform basic text editing functions. 

    • powerful commands themselves are difficult to remember. 

  • mcedit editor (Midnight Commander Editor)

    • mcedit is a link to mc, the main GNU Midnight Commander executable.

    • Executing GNU Midnight Commander under this name requests staring the internal editor and opening the file specified on the command line.

    • The editor is based on the terminal version of cooledit (standalone editor for X Window System).

Linux text editor2

  • joe (Joe’s Own Editor)

    • JOE is a full featured terminal-based screen editor

    • It is distributed under the GNU General Public License (GPL).

    • JOE has been around since 1988

    • It is comes standard with many Linux distributions.

    • JOE is being maintained by its original author Joseph Allen

    • JOE is written in C and its only dependency is libc.

Linux text editor3

  • Graphical text editors:

    Nedit editor

    • already installed in Computer Systems

    • smaller and easier to use/customise than emacs

    • easy to get it to do syntax colouring for Java/HTML etc

    • suitable for Unix/Linux only (see below)

    • impossible to use via telnet/ssh

    • more difficult than emacs

      Xedit editor

    • It is a text editor for the X Window System on Linux and UNIX

    • It is a visual text editor for the virtual machine operating system