Unix/Linux Tutorials | Input,Output and Error "Redirection" In Simple Way | by DURGA Sir

Input,Output and Error "Redirection" In Simple Way
=========================================
Input and output of commands:
-------------------------------------------------
Diagram
Commands can take input, perform certain operation and produces the corresponding output. While executing command if anything goes wrong then we will get error message.
Command can take input either from standard input or from command line arguments.
Command will produce results to either standard output or standard error.
Standard Input, Standard Ouput and Standard Error are data streams and can flow from one place to another place. Hence redirection and piping concepts are applicable for these.
Command Line arguments are static and these are not streams. Hence redirection and piping concepts are not applicable to command line arguments.
These data streams are associated with some numbers.
Standard Input associated with 0.
Standard Output associated with 1.
Standard Error associated with 2.
Bydefault standard input connected to keyboard, Standard output and Standard Error are connected to Terminal. But based on our requirement we can redirect these streams.
Standard Input from the keyboard and output to Standard output device:
----------------------------------------------------------------------
For the cat command, if we are not providing any arguments, then the input will be taken from standard input device (keyboard) and display the output to the standard output device.
durgasoft@durgasoft:~$ cat
This data is from keyboard
This data is from keyboard
This is my second line
This is my second line
ctrl+d
Input from command line arguments and error messages to the standard error device( terminal):
-----------------------------------------------------------------------------------
durgasoft@durgasoft:~$ rm file1234.txt
rm: cannot remove 'file1234.txt': No such file or directory
We are providing filename as command line argument to the rm command.
If the specified file not available then we will get error and that error message will be printed to the Standard Error device (Terminal).
Note:
Some commands can accept only standard input and some commands can accept only command line arguments and some commands can accept both.
1. rm command can accept only command line arguments.
rm file1 file2
2. echo command can accept only command line arguments.
echo "durgasoft"
3. cat command can accept both command line arguments and standard input
Redirection:
===========
As Standard Input, Standard Ouput and Standard Error are data streams and we can redirect these streams.

Пікірлер: 11

  • @lokesht8466
    @lokesht84662 жыл бұрын

    What an explanation sir 🤗👍We are blessed to listen your classes

  • @rajdulari_tadwal4912
    @rajdulari_tadwal49123 жыл бұрын

    Hatts off all durgasoft people's....u all are amazing...thnx for this...

  • @bikashranjanswain3006
    @bikashranjanswain3006 Жыл бұрын

    You are the GOD of teaching

  • @bungatavula
    @bungatavula Жыл бұрын

    Nujamga meru devudu sir. Maa trainer 1 hour cheppadu. Kani em Arkham kaledu. Mee explanation keka sir

  • @usmanjawaid5362
    @usmanjawaid53624 жыл бұрын

    Best ever teacher I have ever experience in all my Life.

  • @RajuPatel-bi7sv
    @RajuPatel-bi7sv3 жыл бұрын

    Nice sir ji👌👌🙏🙏

  • @mandeep2192
    @mandeep21922 жыл бұрын

    great explanation..loved It!!

  • @madrasapattinam
    @madrasapattinam4 жыл бұрын

    thank you sir! you are truly a students' teacher.

  • @malli_malta
    @malli_malta Жыл бұрын

    Well explained sir..thanks a lot. My confusion is cleared now.🤝👌

  • @ujjalsamanta5841
    @ujjalsamanta58414 жыл бұрын

    ever ever best guru .

  • @usmanjawaid5362
    @usmanjawaid53624 жыл бұрын

    Listening Your lecures on Java 7 and practicing i passed the whole OCJP 7 exams.