UNIX Guide, for beginners and Mac OS X users
You are here: SillyDog701 > UNIX Guide >SillyDog701 > UNIX Guide > (index) supportSupport - ask in our friendly forums.

UNIX shell commands

You can run UNIX commands and see their output without leaving vi. You can also insert the output of a UNIX command into the file you that are editing.

To run a single UNIX command use the command:

   :!UNIX_command

You can start a shell from within vi and use it as you would your usual UNIX environment, then exit the shell and return to vi.

To start up a shell enter the command:

   :sh

The type of shell that is started is determined by the $SHELL variable. You can specify that some other shell is to be started by setting the vi shell option.

Return to using vi by entering the command exit or Ctrl-D.

To insert the output from a UNIX command into a file, immediately after the cursor:

   :r!command

For example, this facility would be very useful if you were using vi to document a UNIX command and you wanted to include examples of the output from this command.


[Home]UNIX Guide home | [Search]search | index
Page URL: http://sillydog.org/unix/
[SillyDog701] [Netscape] [MozInfo701] [MacCentre701] [UNIX Guide] [AntTunes701][Forums] [Search] [Change Log] [Feedback] [About Us] [Sitemap]
This UNIX Guide maintained by SillyDog701, portion of this Guide is based on UNIXhelp. UNIXhelp is copyright University of Edinburgh. This page was last modified on 14 March, 2006
Netscape NOW!Made on a Mac
support MozInfo701 and SillyDog701