Re:What typing ^D does on Unix (2009)
by VintageCool on Tuesday September 06, 2016 @04:05PM
(#12438903)
Neat. So when my terminal is spewing output because I ran "cat massivefile" instead of "cat massivefile | head", I can hit ctrl-D to stop it instead of repeatedly hitting ctrl-C and despairing.
[ Parent
| on HN ]
No, thats what ctrl-s and ctrl-q are for.
Here's the rest in one place:
eof VEOF EOF character
eol VEOL EOL character
eol2 VEOL2 EOL2 character
erase VERASE ERASE character
erase2 VERASE2 ERASE2 character
werase VWERASE WERASE character
intr VINTR INTR character
kill VKILL KILL character
quit VQUIT QUIT character
susp VSUSP SUSP character
start VSTART START character
stop VSTOP STOP character
dsusp VDSUSP DSUSP character
lnext VLNEXT LNEXT character
reprint VREPRINT REPRINT character
status VSTATUS STATUS character
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;Back in the day, using a slow modem or teletype, discard (flush output) was super important, but several years back when I hooked up an actual Wyse dumb terminal to a Linux box I was dismayed to discover that it's actually not implemented in Linux.
Re:What typing ^D does on Unix (2009)
by vram22 on Wednesday September 07, 2016 @12:28PM
(#12444687)
Nice. Reminds me of using the "stty -a" and "stty <some_param>" commands many times on Unix terminals, back in the day, for some of those settings you list, also for things like CR/LF translation (ocrnl, onlcr, ...), raw, sane, ...
Re:What typing ^D does on Unix (2009)
by gonvaled on Tuesday September 06, 2016 @04:34PM
(#12439108)
I don't think so, since cat is reading from massivefile, not from your tty.
Also, a side note, I would rather just run "head massivefile" or even better "less massivefile" (because, most probably I'd want to see past what head shows by default). Running cat and then piping it to another program is inefficient, 2 forks + pipe.
Re:What typing ^D does on Unix (2009)
by sigjuice on Tuesday September 06, 2016 @09:29PM
(#12440448)
But you miss out on this award if you don't use cat :p
http://porkmail.org/era/unix/award.html
Re:What typing ^D does on Unix (2009)
by vram22 on Wednesday September 07, 2016 @12:31PM
(#12444725)
And on systems where head was not present (seen some earlier), but sed was, you could do:
sed nq file
where n is some positive integer, to print the first n lines of the file.
Also, body (the complement of head and tail :)
# body
sed -n $1,$2p $3