You could use /dev/stdout
. But that won't always work if a program needs to lseek(2) (or mmap(2)) it.
Usually /dev/stdout
is a symlink to /proc/self/fd/1
(see proc(5)).
IIRC some version of some programs (probably GNU awk) are handling specifically the /dev/stdout
filename (e.g. to be able to work without /proc/
being mounted).
A common, but not universal, convention for program arguments is to consider -
, when used as a file name, to represent the stdout (or the stdin). For example, see tar(1) used with -f -
.
If you write some utility, I recommend following that -
convention when possible and document if stdout needs to be seekable.
Some programs are testing if stdout or stdin is a terminal (e.g. using isatty(3)) to behave differently, e.g. by using ncurses. If you write such a program, I recommend providing a program option to disable that detection.