S i and we're using Linux edit any file from the command line, you can use multiple editors. In this case we will learn to manage VIM, as it is the most powerful of which has the OS
• When editing a file editor is opened in normal mode from which we can make shortcuts for operations. It is a way of viewing the content and not editing, that is, not allow us to make changes. • To start editing, and thus enter the edit mode, you type in the sequence i or press the insert
.Once we are in the editor so we can check that shows the words / characters in different colors. This is because it automatically detects, by type of content, language is written in the file.
If our vim not have this aspect, you may be overlooking that is installed a basic version of the editor. This is solved by installing the full version with the command: aptitude install
vim-common and typing in the normal way vim: syntax on
At this point it is interesting to know some of the most frequently used commands :
• Text Options (normal mode) or
May + v == Select text or
dd Delete current line ==
oror undo the last change ==
or CTRL + R
== Redo the last change or
== guu Make current line to lowercase
or GUU= = Convert to uppercase the current line or
gg ==
position at the beginning of the file or
== G
Positioning at end of file or
:
num == num placed on line
or ga== Displays ASCII code, hexadecimal and octal current character
• Save and exit (normal) or
:
== q Quit the editor without saving or
: q!
== Exit the editor without saving or prompting
or: wq
== Save and Exit the editor or
: w file.txt ==
Save in a file called file.txt
or: e file.txt ==
Closes the current file and open the file.txt
• Useful commands (normal mode)
or delete character x
==
or:% s/texto_1/texto_2 / ==
replace text or
/ texto_a_buscar /
== Search text (if you click "No" to seek the next match)
• Preferences default (normal mode)
or
: set ts
= num num == set tabulated in
spaces or: set sw = num ==
set num adding spaces or
: set number / nonumber
== numbered files or
: September backup / nobackup
Automatic Backup ==
or: set directory = dir == Folder
copies
or: syntax on / off syntax highlighting
==
or: {color evening / darkblue / desert / elflord / Koehler / morning} == Recolor
or
: set cindent
Auto Indent ==
or: set mouse = a / mouse = mouse
== Use
or: set paste / nopaste
paste text mode ==
or:
== Spell Corrector
spelling or: setlocal spell spelllang = == Change language is
or
: set spellfile = ~ /. vimdic ==
Dictionary of unknown words
• More commands
or
:! command Run a command ==
or
: Pause == shell
edition (to return to the editor type exit) or
: set number
== Displays the numbered lines
sure many of you know more commands, so I encourage you to share your knowledge with us.
sudo cp / etc / ssh / sshd_config / etc / ssh / sudo chmod sshd_config.original
AllowOverride None