Receive all updates via Facebook. Just Click the Like Button Below

Input - Output redirection in Shell Scripts

Using shell scripts, we can redirect
- the output of a command to a file
- redirect an output file as an input to other commands.

There are mainly 3 types of redirection. They are >,>>,<


Input - Output redirections in Linux Shell Scripting


1. >

ls > ls-file

The above command will redirect the output of the " ls " to the file " ls-file ".
If the file " ls-file " already exist, it will be overwritten. Here you will loose the existing data.

2. >>

date >> ls-file

The output of the date command will be appended to the file " ls-file ".
In this case you will not loose any data. The new data gets added to the end of the file.

3. <

cat < ls-file

This redirection symbol takes input from a file.
In the above example the cat command takes the input from the file " ls-file " and displays the "ls-file" content.


Related posts:

Advertise here

picture picture

Follow us


- Tech-Tutorials

Like us

About Techcuriosity

I am Telson, the webmaster of and through this site, I share my knowledge and curiosities in the Tech World.

What We Offer

  • What is ..?
  • How to ..?
  • Difference between ..?
  • How .. works?
  • Get in Touch
    UK : +44 77 33 890 678

    picture picture

    Our Partners

  • Website Design Dubai
  • SEO Link Exchange
  • picture