Various kinds Editor There are many text editors that can be used in the UNIX world. Here is an example of the many text editors. nano is a popular text editor provided by many Linux distributions and is also typically available when installing UNIX. gedit is graphical text editor in GNOME desktop. Screen-oriented editor Jed is made for programmers. With the color code designates Jed allows you to write so you can read it easier and faster to find syntax errors. Use the alt key to select the menu for manipulating text. kate editor that looks sweet that comes in packages of KDE. It has many features such as highlighting for various programming languages and arrangement of words. kedit text editor packaged in KDE GUI. with mcedit you can save, copy, move and delete text. Like Jed and joe, mcedit is also oriented screen. nedit would be perfect editor for programmers. You need to install additional packages to get this editor.
Introduction to vi When you use ssh in the network, you can use any text editor. GUI editor that is able to appear on the screen. But if the GUI is not available then you are obliged to use shell-based text editor such as vi, Jed or joe. Why do we learn vi text editor rather than the other. Vi is a text editor that is quite difficult to learn. There are no instructions, menus or icons. But once you know that you no longer need a mouse or function keys, you can edit and move quickly and efficiently only with the keyboard.
Move between modes Often somebody pressed "Esc" key to get out of vi but he can't (It's not me). pressing "Esc" switches to command mode. Oh yes in vi, there are two modes of command and insert. vi always starts in command mode so if you open a file such as passwd (vi /etc/passwd) and then want to change something you must first enter insert mode by pressing i or a or "insert"
Navigating in vi For navigation (in command mode) we can use the j button to go down one line k move up one line, l to slide to right and h to slide to left
h left j down k ride l right
press the number 5 then j (5j) then you will go down five lines, as well as other commands that can be combined with numbers that make your job effectively (you do not need to press keys until line 1000 j. 1000j enough with you will go down 1000 line). You can also go directly to a thousand with the command line: 1000 then press "Enter" or 1000G (uppercase G). But this command is different from 1000j (if you press 1000j you will be brought into line in 1001 because of your initial position on line 1, while the command: 1000 and 1000G will take you to the 1000 lines no matter where your starting position. Command :1000 and 1000G have resemblance which means :1 is identical to 1G not G because G will lead you to the last line of a file (believe it or not). There is another trick to navigation in addition to hjkl vi, press w to move forward and b the right one to go back one word. Press also $ (dollar sign) to the end of the line, A advances to the end of the line and go into insert mode, and press the "Esc" then 0 (zero) to return to the starting of the line.
Changing a file is done in insert mode. as described earlier i key to enter insert mode and "Esc" to the command mode. R button will help you replace one character under the cursor right (remember only one), press five random characters so that one is not replaceable only five-limanya. Continuing to replace many characters r will make you tired, thanks to god, you can replace many characters with the R key (uppercase).
x key deletes character right at the cursor (like delete) and X (uppercasel X) to delete characters before cursor (like backspace). dw will help you delete the character at the cursor to the end of words. Removing characters up to the beginning of words can be done with d$. I would like to remove up to the beginning of the word but do not want to delete the character at the cursor, there is the recipe? Yes it is d0. And deleting one line is dd. Opening a file could be done by typing the command followed by the full file name with pathnya example vi /etc/passwd. Adding +5 to command (vi /etc/passwd +5) will take you directly to the fifth line. We had opened /etc/passwd. Now willing to open anither session without closing the current session? The answer is: e /etc/shadow. vi successfully open the /etc/shadow. now the first session become invisible. it will be vesible again after closing the current sessio. if we want to see both session split /etc/shadow would be a good solution.
In vi there are many important buttons that you can use in command mode. This button allows you to switch between modes, navigation, delete, copy, browse and manage files.
OPERATING FUNCTION BUTTON Interactive mode
Esc key enters command mode. i enters insert mode at cursor i. A enters the insert mode at the end of the line.
h slides left, j moves down, k moves up, and l slides right. $ leads to the end of the line. ^0 leads to the beginning of the line. G leadsto the end of the file. :1 or 1G leads to the beginning of the file. :47 or 47G leads to line 47. Ctrl + f scrolls down one page. Ctrl + dPage scrolls down half page. Ctrl + b scrolls up one page. Ctrl + u scrolls up half page.
dd removes one line. 5dd removes five lines. r replaces one character. R replaces many characters. x Deletes one character. 10x del Removes ten characters. dw removes one word. 5dw removes five words. yw copies one word. yy copies one line. p pastes the copied or deleted string.