Artificial intelligent assistant

Decoding "prog > file 2>&1" I am having some difficulty understanding the construct `prog > file 2>&1`. I have read that it means "Send _stdout_ and _stderr_ to file". But my question is how? I understand that `prog > file` basically sends _stdout_ to file. I also understand that `prog 2>&1` means that the _stderr_ should be sent to _stdout_. But I am not able to connect the dots for `prog > file 2>&1`. Can experts here help me decode this.

You just have to read it left to right:

* `> file` \--> redirect all thing from `stdout` to `file`.(You can imagine you have a link, point-to-point from `stdout` to `file`)
* `2>&1` \--> redirect all thing from `stderr` to `stdout`, which is now pointed to `file`.



So conclusion:


stderr --> stdout --> file


You can see a good reference here.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0221787c2aa3ac46cff67b4c6d2f73f5