Krishna Logo
qa training in canada now
Divied
Call: Anusha @ 1 (877) 864-8462

 

Latest News
Home Navigation Divied
INTERVIEW Navigation Divied UNIX INTERVIEW QUESTIONS Navigation Divied What do you understand by 2>&1 in UNIX?
What Do You Understand By 2>&1 In UNIX?
What do you understand by 2>&1 in UNIX?

 

What do you understand by 2>&1 in UNIX?
Ans: In UNIX you have STDIN, which is denoted by number 0, STDOUT, which is denoted by 1, and STDERR, which is denoted by 2. So, the above line means, the error messages go to STDERR, which is redirected to STDOUT. So, the error messages go to where ever the STDOUT goes to. For example, the following command creates a multiple directories for a maven based Java project. If the directory creation is successful, change directory to "project" and print the directory tree structure. The STDOUT and STDERR are directed to the file named maven-project.log under the project folder. 
1 $ Mkdir -p project/{src/{main/{java, resources},test/{java, resources}}} && cd project ; find . -type  d -print  > maven-project.log
The output will be something like
 
Src
./src/main
./src/main/java
./src/main/resources
./src/test
./src/test/java
./src/test/resources

Shadow Bottom
 
 
© 2005 -