Search code examples
linuxstdoutstderroutput-redirect

On a Linux system, how would I redirect stdout to stderr?


I think its the case that you can't just assign the stdout to stderr because other things might have already cached (?) stdout by the time the reassignment takes place.

So how do I do this (using Linux)?


Solution

  • To redirect the stdout to stderr, use your command as follows :-

    $ command-name 1>&2
    

    where command-name is the command you're going to feed, 1 represents stdout and 2 represents stderr .