Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of "-u" option in cat command? [closed]

Tags:

c

linux

unix

cat

I came across this in man cat (GNU/Linux).
The manual simply says -u (ignored) without explaining why.
Out of curiosity I searched on Google but it seems no one asked this before.
Then I looked at other implementations of cat.
I noticed Apple's cat also implements this option (see cat.c). In the source code it says

...
case 'u':
    setbuf(stdout, NULL);
    break;
...

I guess this option means 'unbuffered'. What is the inteneded use of this option? Why is it there and why is it ignored? I think there must be some reason for that.

like image 275
navigaid Avatar asked Feb 16 '17 16:02

navigaid


1 Answers

It is a POSIX compliant option for Unix/Linux. GNU cat does this automatically and there is no way to turn it off. When specified, it is accepted but ignored because it has no effect on the behavior.

More details cat(1):

-u Write bytes from the input file to the standard output without delay as each is read.

like image 186
Seek Addo Avatar answered Sep 17 '22 20:09

Seek Addo