Send standard error and standard out to the same file

This article may seem odd to those who have read a few of my others. However, this is by far my highest ranking search term. Thus I thought I would write up an simple and explicit explanation.

The following will send the output of ls -la /somewhere to something.txt. This includes standard output and standard error:

# ls -al /somewhere 2>&1 >something.txt

Was this post helpful?