Search code examples
linuxterminalstdoutopenwrt

Does writing data to stdout in linux occupy disk space?


I want to know whether writing data to stdout on a terminal in linux occupies disk space. I tried to look up information about stdout and tty in the man page, but it seems no answer to the question.

Thanks for any tip.

I have a router on which I have installed openwrt, but the total space of the router is 2MB and now there is only 12KB left. And I want to run a bash script to print some information on the terminal in the openwrt system. So I want to know whether it could occupy disk space when printing data to stdout.


Solution

  • Unless the output is being redirected (though pipes to e.g. tee, or to a file with the > shell redirection operator), then no, output will not go to a file system. Output to a console (or terminal emulator) is slow as it is, passing it through the file system would make it even slower, and may not allow the disks to spin down if there's a lot of output.

    It may, however, end up in the swap space, if the OS thinks the process should be swapped out before the output is actually written.