What is vi?The default editor that comes with the UNIX operating system is called vi (visual editor). [Alternate editors for UNIX environments include pico and emacs, a product of GNU.] Show
To Get Into and Out Of viTo Start viTo use vi on a file, type in vi filename. If the file named filename exists, then the first page (or screen) of the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text.
To Exit viUsually the new or modified file is saved when you leave vi. However, it is also possible to quit vi without saving the file. Note: The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the <Return> (or <Enter>) key.
Moving the CursorUnlike many of the PC and MacIntosh editors, the mouse does not move the cursor within the vi editor screen (or window). You must use the the key commands listed below. On some UNIX platforms, the arrow keys may be used as well; however, since vi was designed with the Qwerty keyboard (containing no arrow keys) in mind, the arrow keys sometimes produce strange effects in vi and should be avoided. If you go back and forth between a PC environment and a UNIX environment, you may find that this dissimilarity in methods for cursor movement is the most frustrating difference between the two. In the table below, the symbol ^ before a letter means that the <Ctrl> key should be held down while the letter key is pressed.
Screen ManipulationThe following commands allow the vi editor screen (or window) to move up or down several lines and to be refreshed.
Adding, Changing, and Deleting TextUnlike PC editors, you cannot replace or delete text by highlighting it with the mouse. Instead use the commands in the following tables.
Inserting or Adding TextThe following commands allow you to insert and add text. Each of these commands puts the vi editor into insert mode; thus, the <Esc> key must be pressed to terminate the entry of text and to put the vi editor back into command mode.
Changing Text
Deleting TextThe following commands allow you to delete text.
Cutting and Pasting TextThe following commands allow you to copy and paste text.
Other CommandsSearching TextA common occurrence in text editing is to replace one word or phase by another. To locate instances of particular sets of characters (or strings), use the following commands.
Determining Line NumbersBeing able to determine the line number of the current line or the total number of lines in the file being edited is sometimes useful.
Saving and Reading FilesThese commands permit you to input and output files other than the named file with which you are currently working.
Which of the Linux commandThere are two commands used to kill a process: kill – Kill a process by ID. killall – Kill a process by name.
Which Linux commands is used to edit a text file?There are two command-line text editors in Linux®: vim and nano. You can use one of these two available options should you ever need to write a script, edit a configuration file, create a virtual host, or jot down a quick note for yourself.
What is the name of a command prompt in a Unix Linux operating system?Bash is the most commonly used command-line shell for Unix-based OSes including Linux. The software that handles the command-line interface is commonly referred to as a command language interpreter, a command processor or command interpreter.
|