KEMBAR78
Redirection of output and input in unix/linux | PPTX
Created by
TopicsSHELL1Different types of shell
Summary of shell features
Configuration files for shellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
Redirect usage12Different types of shellShellPathDescriptionOSBourne/bin/shThis is the original Unix shell written by Steve Bourne of Bell Labs. It is available on all UNIX systems.All unixKorn/bin/kshThis shell was written by David Korn of Bell labs. It is now provided as the standard shell on Unix systems.AIXC/bin/cshThis shell was written at the University of California, Berkeley. It provides a C-like language with which to write shell script.BSDTC/bin/tcshThis 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 OSXBash/bin/bashThis is a public domain shell written by the Free Software Foundation under their GNU initiative.Ubuntu, CentosReference: http://unixhelp.ed.ac.uk/shell/oview2.html
TopicsSHELL1Different types of shell
Summary of shell features
Configuration files for shellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
Redirect usage12Summary of shell features BourneCTCKornBashCommand historynoyesyesyesyesCommand aliasnoyesyesyesyesShell scripts yesyesyesyesyesFilename completion noyes*yesyes*yesCommand line editing nonoyesyes*yesJob control noyesyesyesyes* Not the default setting for this shell.Reference: http://unixhelp.ed.ac.uk/shell/oview1.1.html
TopicsSHELL1Different types of shell
Summary of shell features
Configuration files for shellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor

Redirection of output and input in unix/linux

  • 1.
  • 2.
  • 3.
  • 4.
    Configuration files forshellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
  • 5.
    Redirect usage12Different typesof shellShellPathDescriptionOSBourne/bin/shThis is the original Unix shell written by Steve Bourne of Bell Labs. It is available on all UNIX systems.All unixKorn/bin/kshThis shell was written by David Korn of Bell labs. It is now provided as the standard shell on Unix systems.AIXC/bin/cshThis shell was written at the University of California, Berkeley. It provides a C-like language with which to write shell script.BSDTC/bin/tcshThis 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 OSXBash/bin/bashThis is a public domain shell written by the Free Software Foundation under their GNU initiative.Ubuntu, CentosReference: http://unixhelp.ed.ac.uk/shell/oview2.html
  • 6.
  • 7.
  • 8.
    Configuration files forshellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
  • 9.
    Redirect usage12Summary ofshell features BourneCTCKornBashCommand historynoyesyesyesyesCommand aliasnoyesyesyesyesShell scripts yesyesyesyesyesFilename completion noyes*yesyes*yesCommand line editing nonoyesyes*yesJob control noyesyesyesyes* Not the default setting for this shell.Reference: http://unixhelp.ed.ac.uk/shell/oview1.1.html
  • 10.
  • 11.
  • 12.
    Configuration files forshellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
  • 13.
    Redirect usage12Configuration filesfor shellsshkshcshtcshbash/etc/.loginloginlogin/etc/csh.cshrcyesyes/etc/csh.loginloginlogin~/.tcshrcyes~/.cshrcyesyes~/.loginloginlogin~/.logoutloginlogin/etc/profileloginloginlogin~/.profileloginloginlogin~/.bash_profilelogin~/.bash_loginlogin~/.bash_logoutlogin~/.bashrcint. + 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
  • 14.
  • 15.
  • 16.
    Configuration files forshellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
  • 17.
    Redirect usage12Redirect descriptorDescriptorDescription0StandardInput (Generally Keyboard)1Standard output (Generally Display/Screen)2Standard Error Ouput (Generally Display/Screen)>Redirect standard output2>Redirect standard error2>&1Redirect standard error to standard output<Redirect standard input from>>Append to standard output&Run as background process
  • 18.
  • 19.
  • 20.
    Configuration files forshellsREDIRECTION OF OUTPUT AND INPUT 2Redirect descriptor
  • 21.
    Redirect usage12Redirect usageLetme write the example about how to use redirection in various purpose.Redirect standard output to a file #!/bin/bash/home/panu/start-application1.sh > fileAppend standard output to a file #!/bin/bash/home/panu/start-application1.sh >> fileRedirect standard input from file#!/bin/bash/home/panu/start-application1.sh < fileRedirect 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.logRedirect standard error to standard output “std_out_err.log”#!/bin/bash/home/panu/start-application1.sh > std_out_err.log  2>&1
  • 22.
    Thank you forwatchingmy presentationCreated bypanuausavasereelertblog: http://panu.in.themail: panu@panu.in.thtwitter: @panuinth