Redirect standard output
ls -al 1>std.out

Redirect standard error output
ls -z 2>error.out

Redirect to the same file

ls -z 1>error_std.out 2>&1