How to Redirect the Standard Input, Output, and ErrorStreams?

Answer Posted / manavalan

0 (zero) refers to the standard input & often abbreviated as stdin.
1 refers to standard output (stdout)
2 refers to standard error (stderr)

Redirecting Standard Error :

The 2 in 2> refers to stderr.

$ lsash /usr/bin 2> commands-error.txt


Redirecting both Standard Ouput & Standard Error.

Use 2>&1 Syntax to redirect standard error to the same location as standard output .


$ ls /usr2222/bin > command.txt 2>&1

Redirecting Both stderr & stdout at Once

$ ls /usr2222/bin &> command.txt

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ipc$ used for?

752


Explain Communication Between Parent and Child Processes?

1475


How to Debugg Semaphores?

1229


What is ipc namespace?

674


What are System Calls?

1389


How many types of ipc mechanism do you know?

642


What are the ipc techniques?

693


What is ipc a 600?

689


What is ipc certified?

657


What is an ipc code?

735


What are the Uses of mmap?

1381


What is Datagram style?

1309


What is Fast Local Communication?

1209


How to obtain information about shared memory?

1258


What does ipc class mean?

753