ls -la /dev | grep 'std.*'
# this should show which file descriptors (fd) are matched to each standard input/output, like this:
# stdin -> fd/0
# stdout -> fd/1
# stderr -> fd/2Redirect stdout
ls > ls.txt
cat ls.txtRedirect stderr
ls noexist 2> ls-errs.txt
cat ls-errs.txtRedirect stdout and stderr to the same file Note the ampersand which tells bash that we're redirecting to a file descriptor (rather than an actual file)
ls noexist > ls.txt 2>&1
cat ls.txtRedirect stdin
cat < ls.txt