view Command
Purpose
Starts the vi editor in read-only mode.
Syntax
view [ -cSubcommand ] [ -l ] [ -t Tag ] [ -wNumber ] [ -y ] [ -r [ File ] ] [ + [ Subcommand ] ] [ File ... ]
Description
The view command starts the vi full-screen editor in read-only mode. The read-only mode is only advisory to prevent accidental changes to the file. To override read-only mode, use the ! (exclamation point) when executing a command. The File parameter specifies the name of the file you want to browse. Use vi subcommands for moving within the file. Use the :q subcommand to exit the view command. If you modify the file you can save your modifications by pressing the Esc key and wq!.
Flags
Item | Description |
---|---|
-cSubcommand | Carries out the ex editor subcommand before viewing with vi begins. When a null operand is entered, as in -c '' , the editor places the cursor on the last line of the file. |
-l | Enters a version of the vi editor with specialized features designed for writing programs in the LISP language. In this mode, the vi editor indents appropriately for LISP programming, and the (, ), {, }, [[, and ]] subcommands are modified to act appropriately for LISP. |
-r [File] | Recovers a file after an editor or system crash. If you do not specify a File parameter, the editor displays a list of all saved files. |
-tTag | Edits the file containing the tag specified by the Tag parameter and positions the editor at its definition. To use this flag, you must first create a database of function names and their locations using the ctags command. |
-wNumber | Sets the default window size to the value specified by the Number parameter. This is useful when your terminal communicates with the system running the editor over a slow communications line. |
-y | Overrides the maximum line setting of 1,048,560 with any value greater than 1024. |
+[Subcommand] | Carries out the ex editor subcommand specified by the Subcommand parameter before viewing with vi begins. If you do not specify a subcommand, the cursor is placed on the last line of the file. |