gudii9
asked on
what is 2> command used for
Hi,
what is 2> command used for
please advise
what is 2 what is >
what is 2> command used for
please advise
what is 2 what is >
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this is something you append to a command. It is not a command meaning do this now and forever more.
Example:
Type ls and press enter
Now type ls -y and press enter
Now type ls -y 2>error.txt and press enter
with 2>error.txt nothing is displayed... but you just saw that ls -y gives an error. So now open error.txt and you'll see the error that ls -y provided. You redirected the standard error output of that command.
Example:
Type ls and press enter
Now type ls -y and press enter
Now type ls -y 2>error.txt and press enter
with 2>error.txt nothing is displayed... but you just saw that ls -y gives an error. So now open error.txt and you'll see the error that ls -y provided. You redirected the standard error output of that command.
When would you use 2>? When you are running a script or a program that could return a lot of error information and capturing it to a file for later review makes sense. Scripting could do this - using 2> would capture all errors a script generated but not all the noise (successes).
ASKER
https://www.tutorialspoint.com/unix_terminal_online.php
i opened error.txt but do not see any error message like below in that
bash: syntax error near unexpected token `newline'
please advise