[Chapter 8] 8.6 Interacting with UNIX
Author: Daniel Gilly & the Staff of O'Reilly & Associates
Date: 1998-08-06T21:59:56Z

#

| Chapter 8 The Vi Editor |

## 8.6 Interacting with UNIX

:r `file` | Read in contents of `file` after cursor.
:r !`command` | Read in output from `command` after current line.
:`n`r !`command` | Like above, but place after line `n` (0 for top of file).
:!`command` | Run `command`, then return.
!`object command` | Send buffer `object` to UNIX `command`; replace with output.
:`n1`,`n2`!`command` | Send lines `n1` -`n2` to `command`; replace with output.
`n`!!`command` | Send `n` lines to UNIX `command`; replace with output.
!! | Repeat last system command.
:sh | Create subshell; return to file with `EOF`.
CTRL-Z | Suspend editor, resume with `fg` (not in all versions).
:so `file` | Read and execute commands from `file`.

8.5 Accessing Multiple Files |  | 8.7 Macros