Live data from Hacker News

What typing ^D does on Unix (2009)

utcc.utoronto.ca

71–80 of 162 posts

Re: What typing ^D does on Unix (2009)

#71

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.

I don't think so, since cat is reading from massivefile, not from your tty.

Re: What typing ^D does on Unix (2009)

#72
post #45
post #43

Earlier quoted context omitted.

^D, Ctrl+D and C-d are all different ways of saying the same thing. There's nothing particularly neutral about Ctrl+D, any more than there is about using the word 'water' to mean the substance of which the oceans are mostly comprised — it's just another dialect's term.

It's not about neutrality, it's about ease of understanding. For me at least, when speaking about something that can be entered into a keyboard ^D is less obvious than Ctrl+D–I need to press the key labeled "control" to issue the proper command, the key labeled "^" will not suffice.

To be really pedantic (sorry! I'm not complaining about your comment), your keyboard does not have any key labelled 'control', it is always (AFAIK) abbreviated as 'ctrl'. Which is really weird to me, as it's hardly a big word needing abbreviating, and keyboards often have other long words written on the keys ('delete', 'page down', and so on).

On top of that, the shortened 'ctrl' is really a terrible abbreviation. It's not obvious that it stands for 'control' and I would guess that most non-techy people would have no idea that it means this word. Plus, it's near to another key with multiple letters ('alt'). The overall effect is that 'ctrl' appears to just be a jumble of letters with some esoteric meaning. A really odd design decision. Why not just put 'control' on the key and be done with it?

Re: What typing ^D does on Unix (2009)

#73
post #40
post #25

Earlier quoted context omitted.

In readline, ^U will only clear from the cursor to the start of the line, leaving anything on the right. ^K is the converse. I'm not sure you are speaking about readline though. Another very useful thing I use daily is Alt-F/B, to move forward/backward in the line one word at a time. Control does the same, one letter at a time. D will delete an element instead.

There's a lot of unexpected gems in the readline defaults. I recommend people try paging through "bind -p" in bash some time to see what's there. Personal favorites are C-r to search back in history and C-x C-e to edit the current command line in an external editor.

Weird, I'd have thought C-r is the one readline command everybody knows even if they know nothing else abour readline. Almost cannot imagine using command line without it. (Though there's also the "like tab-complete but from history" that I never really learned to use.)

Re: What typing ^D does on Unix (2009)

#77
post #74

^U will clear the buffer - super convenient for retrying botched passwords.

Something I use extensively in terminals is ^L and ^M. ^L clear the screen and ^M for a line return.

May I ask why you find more convenient to press ^M for a line return instead of the line return key?

Re: What typing ^D does on Unix (2009)

#78
post #45

Earlier quoted context omitted.

It's not about neutrality, it's about ease of understanding. For me at least, when speaking about something that can be entered into a keyboard ^D is less obvious than Ctrl+D–I need to press the key labeled "control" to issue the proper command, the key labeled "^" will not suffice.

To be really pedantic (sorry! I'm not complaining about your comment), your keyboard does not have any key labelled 'control', it is always (AFAIK) abbreviated as 'ctrl'. Which is really weird to me, as it's hardly a big word needing abbreviating, and keyboards often have other long words written on the keys ('delete', 'page down', and so on). On top of that, the shortened 'ctrl' is really a terrible abbreviation. It…

You're incorrect, especially for the typical reader here. A good chunk (maybe not over 50%, but its gotta be close) of the regular readers on this site use Macs. Most Mac keyboards, including the ones on the Macbook Pro, spell it out. Same for most non IBM/IBM-PC compatible keyboards.

Re: What typing ^D does on Unix (2009)

#79
post #74

^U will clear the buffer - super convenient for retrying botched passwords.

Something I use extensively in terminals is ^L and ^M. ^L clear the screen and ^M for a line return.

I'm not proud of this, but I sometimes bounce between ^N (next-line in emacs) and ^I (tab character, bound to various thing in different emacs modes) to re-indent a region. I usually only do this for <10 lines. More than that and I go look up the function that does it 'right'.

Re: What typing ^D does on Unix (2009)

#80
post #45

Earlier quoted context omitted.

It's not about neutrality, it's about ease of understanding. For me at least, when speaking about something that can be entered into a keyboard ^D is less obvious than Ctrl+D–I need to press the key labeled "control" to issue the proper command, the key labeled "^" will not suffice.

To be really pedantic (sorry! I'm not complaining about your comment), your keyboard does not have any key labelled 'control', it is always (AFAIK) abbreviated as 'ctrl'. Which is really weird to me, as it's hardly a big word needing abbreviating, and keyboards often have other long words written on the keys ('delete', 'page down', and so on). On top of that, the shortened 'ctrl' is really a terrible abbreviation. It…

[deleted]
Post reply on HN