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] [Search] [Index] This site maintained by system@gantep.edu.tr