14

Since Unix is 40 years old, Unix is older than the invention of the computer mouse. (Actually, only 3 years, if Unix is from 1969 and the mouse from 1972.) How in the world did a new user do anything on Unix without copy & paste? I know they always had a text editor with copy/paste, but everything I do on Linux is copy from web browser, and paste (from the CLIPBOARD) into vim or gedit or gnome terminal. You're the same, right?

I just can't imagine loading up a man file into vim, copying & pasting code from it into a temporary buffer, and then having bash execute that buffer. Maybe they never left emacs; is that the answer?

5
  • 12
    guess why the older UNIX commands are just two letters long? :-) Jul 4, 2011 at 20:26
  • 2
    @RiccardoMurri That's a different issue: it took about a decade for unix shells to have completion. Jul 4, 2011 at 20:36
  • 4
    Note that "the web" wasn't a glimmer in Tim Berners-Lee's eye when unix was written. Indeed computer networking as we know it was still in its infancy. It was a different world. Jul 5, 2011 at 2:10
  • 8
    everything I do is copy and paste seems a very dangerous habit ;) Jul 5, 2011 at 8:44
  • I hardly C&P using the mouse in Vim. Simply use the text commands for that, e.g. yy for copying (yanking) the current line and p for pasting it. Jul 6, 2011 at 14:04

4 Answers 4

31

Copy-paste is older than the mouse. The first unix editor, ed, had the t command to copy a bunch of lines to a different location. In vi, there are various commands to cut, yank and paste text. To copy text between files, you would save the text to copy in a temporary file and import that temporary file in the target document, e.g. with w and r in ed (:w and :r in vi). To include the output of a command in a file, you would redirect its output (mycommand >file or mycommand >>file) and import that file into your document; vi introduced the ! command and friends to directly insert the output without requiring a temporary file.

Loading a man page into Vim or Emacs and copy-pasting from it is routine for Vim/Emacs users. Web browsers didn't exist until Unix was old enough to drink, but the same principle applies anywhere: the clipboard is older than window environments. What window environments brought was cross-application copy-paste, which could be done with only a little more effort through files.

1
  • Thx for seriously answering my question!
    – marinara
    Jul 5, 2011 at 14:29
25

The simple answer is, "they didn't copy & paste." Not in the way you understand it, anyway.

The very earliest Unix systems used teletypes or dumb terminals for interactive use. These devices didn't have the powerful terminal command sets that made later innovations (!) like vi possible. (Yes, once upon a time, vi was high technology.) You therefore had no way to visually mark text to be copied or cut.

Lacking smart terminals, early Unix systems offered a line editor called ed. The closest thing you have to cut-and-paste with ed is the t command, with which you can specify lines by number to be transferred (copied) to another location in the file.

Punched cards and paper tape were still important I/O media at this time. One way to "edit" a paper tape is to filter its data through something like sed, directly from a paper tape reader as it is reading the data in. Today sed gets used for other things, but it was much more important in the early days of Unix.

1
  • 2
    sed is awesome for scraping web pages retrieved with wget.
    – LawrenceC
    Jul 5, 2011 at 0:16
9

No, not everyone is the same. Not everybody copies code off the internet to run on their machine. Some folks actually write code and sometimes post it to the web.

You typically don't have to leave a text editor either to read data in from some other file (such as a man page) or to send data out either for execution or to a file.

Also, I frequently do cross-application copy-paste in a terminal without using the mouse even today. GNU-screen and tmux support using the keyboard to select things from the screen into a clipboard and paste them either to the shell or to other programs in other terminal windows, or keep it for later.

1
  • 4
    +1 "Some folks actually write code". Thank you. The OP just reinforces the stereotype of script-kiddies copy/paste'ing things without knowing what it does. Cargo-Cult Programming someone called it. It wasn't HARDER to do things 'back then', it just required you to KNOW things, rather than have a google-driven memory recall. People used to read things called books, memorized information, and understood how things worked. So much has been lost. (I'm going to point finger at "Visual ...", dumbing down the programmers).
    – lornix
    Aug 2, 2012 at 9:38
4

When I started using SunOS (before Linux existed) if something was really complicated we'd print it out on that lovely green and white bar paper, take it back to the terminal, and get to work. We also (ab)used applications that let us run multiple terminals from a single dial-up. (300 baud modems rocked!)

Oh, and we made lots of single character errors that took days to hunt down. That was life.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .