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?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
marinara
  • 364

4 Answers4

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.

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.

Warren Young
  • 72,032
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.

Caleb
  • 70,105
  • 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 02 '12 at 09: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.