Do the following and it works

~$whatis `ls /bin`
stty (1)             - change and print terminal line settings

stty (2)             - unimplemented system calls

su (1)               - change user ID or become superuser


redirect the output to a file and I get this ?

~$ whatis `ls /bin` > blah

kmod: nothing appropriate.

ntfsck: nothing appropriate.
  • Thanks for the comments guy. my dumb self did not check to see if the stdout actually went to the blah file , which it did and i guess seeing the stderr threw me off. good reiteration of redirection of the streams.
    – ssvegeta96
    Nov 3, 2016 at 18:00

2 Answers 2


> only redirects standard out (stdout), but when whatis cannot find information about a file it writes that to a different stream, stderr. You can redirect that as well with 2> since stderr is file handle 2. You can redirect both stdout and stderr like &> or you could redirect stderr to stdout by doing2>&1

You can read all about redirection here

So in your example if you want all the errors as well as the success to end up in blah you could do

whatis `ls /bin` &> blah

or, using the alternate subshell syntax that's preferred these days:

whatis $(ls /bin) &> blah

though /bin isn't likely to have one though, be careful doing stuff like this. The results of ls /bin will be subject to word splitting, so if any of the files there contain, say, spaces, they would be treated as different arguments to whatis. This is why you're generally discouraged from parsing the output of ls (see this question for a discussion of it)

you could do what you're trying differently like

find /bin -maxdepth 1 -type f -exec whatis {} + &> blah

which will look in /bin and not go deeper (like the glob) then find just files (the type f argument) and for each thing it finds it'll execute whatis, then do the same redirection we had talked about.


whatis searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. Only complete word matches are displayed.

kmod: nothing appropriate. is a message tells that, it didnt find anything for kmod.

if you want to redirect all the output, then try this..

whatis $(ls /bin) > /tmp/a.txt
  • redirecting stdout is exactly what they did; I think you missed the part where whatis wrote to stderr, which wasn't captured by the redirection of stdout.
    – Jeff Schaller
    Nov 3, 2016 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .