Redirection of output and input in unix/linux
Upcoming SlideShare
Loading in...5
×
 

Redirection of output and input in unix/linux

on

  • 1,594 views

It will guide you how to use redirection in unix/linux and comparison of shell type

It will guide you how to use redirection in unix/linux and comparison of shell type

Statistics

Views

Total Views
1,594
Views on SlideShare
1,545
Embed Views
49

Actions

Likes
0
Downloads
16
Comments
0

4 Embeds 49

http://panu.in.th 43
http://www.linkedin.com 3
http://localhost 2
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Redirection of output and input in unix/linux Redirection of output and input in unix/linux Presentation Transcript

  • Created by
  • Topics
    SHELL
    1
    • Different types of shell
    • Summary of shell features
    • Configuration files for shells
    REDIRECTION OF INPUT AND OUTPUT
    2
    • Redirect descriptor
    • Redirect usage
  • 1
    2
    Different types of shell
    Shell
    Path
    Description
    OS
    Bourne
    /bin/sh
    This is the original Unix shell written by Steve Bourne of Bell Labs. It is available on all UNIX systems.
    All unix
    Korn
    /bin/ksh
    This shell was written by David Korn of Bell labs. It is now provided as the standard shell on Unix systems.
    AIX
    C
    /bin/csh
    This shell was written at the University of California, Berkeley.
    It provides a C-like language with which to write shell script.
    BSD
    TC
    /bin/tcsh
    This shell is available in the public domain.
    It provides all the features of the C shell together with emacs style editing of the command line.
    MAC OSX
    Bash
    /bin/bash
    This is a public domain shell written by the Free Software Foundation under their GNU initiative.
    Ubuntu, Centos
    Reference: http://unixhelp.ed.ac.uk/shell/oview2.html
  • Topics
    SHELL
    1
    • Different types of shell
    • Summary of shell features
    • Configuration files for shells
    REDIRECTION OF INPUT AND OUTPUT
    2
    • Redirect descriptor
    • Redirect usage
  • 1
    2
    Summary of shell features
    Bourne
    C
    TC
    Korn
    Bash
    Command history
    no
    yes
    yes
    yes
    yes
    Command alias
    no
    yes
    yes
    yes
    yes
    Shell scripts
    yes
    yes
    yes
    yes
    yes
    Filename completion
    no
    yes*
    yes
    yes*
    yes
    Command line editing
    no
    no
    yes
    yes*
    yes
    Job control
    no
    yes
    yes
    yes
    yes
    * Not the default setting for this shell.
    Reference: http://unixhelp.ed.ac.uk/shell/oview1.1.html
  • Topics
    SHELL
    1
    • Different types of shell
    • Summary of shell features
    • Configuration files for shells
    REDIRECTION OF INPUT AND OUTPUT
    2
    • Redirect descriptor
    • Redirect usage
  • 1
    2
    Configuration files for shells
    sh
    ksh
    csh
    tcsh
    bash
    /etc/.login
    login
    login
    /etc/csh.cshrc
    yes
    yes
    /etc/csh.login
    login
    login
    ~/.tcshrc
    yes
    ~/.cshrc
    yes
    yes
    ~/.login
    login
    login
    ~/.logout
    login
    login
    /etc/profile
    login
    login
    login
    ~/.profile
    login
    login
    login
    ~/.bash_profile
    login
    ~/.bash_login
    login
    ~/.bash_logout
    login
    ~/.bashrc
    int. + n/login
    blank means a file is not read by a shell at all.
    "yes" means a file is always read by a shell upon startup.
    "login" means a file is read if the shell is a login shell.
    "n/login" means a file is read if the shell is not a login shell.
    "int." means a file is read if the shell is interactive.
    Reference: http://en.wikipedia.org/wiki/Unix_shell
  • Topics
    SHELL
    1
    • Different types of shell
    • Summary of shell features
    • Configuration files for shells
    REDIRECTION OF INPUT AND OUTPUT
    2
    • Redirect descriptor
    • Redirect usage
  • 1
    2
    Redirect descriptor
    Descriptor
    Description
    0
    Standard Input (Generally Keyboard)
    1
    Standard output (Generally Display/Screen)
    2
    Standard Error Ouput (Generally Display/Screen)
    >
    Redirect standard output
    2>
    Redirect standard error
    2>&1
    Redirect standard error to standard output
    <
    Redirect standard input from
    >>
    Append to standard output
    &
    Run as background process
  • Topics
    SHELL
    1
    • Different types of shell
    • Summary of shell features
    • Configuration files for shells
    REDIRECTION OF INPUT AND OUTPUT
    2
    • Redirect descriptor
    • Redirect usage
  • 1
    2
    Redirect usage
    Let me write the example about how to use redirection in various purpose.
    Redirect standard output to a file
    #!/bin/bash
    /home/panu/start-application1.sh > file
    Append standard output to a file
    #!/bin/bash
    /home/panu/start-application1.sh >> file
    Redirect standard input from file
    #!/bin/bash
    /home/panu/start-application1.sh < file
    Redirect standard output to “std_out.log” and redirect standard error to “std_error.log”
    #!/bin/bash
    /home/panu/start-application1.sh > std_out.log  2> std_err.log
    Redirect standard error to standard output “std_out_err.log”
    #!/bin/bash
    /home/panu/start-application1.sh > std_out_err.log  2>&1
  • Thank you for watching
    my presentation
    Created by
    panuausavasereelert
    blog: http://panu.in.th
    email: panu@panu.in.th
    twitter: @panuinth