Chapter 4 -Vim learning linux editor and Shell script command

November 17, 2019

Today VIM text editor learned a lesson, I feel a lot of knowledge related to
1, a text editor
in the Linux file system, everything is, a service that is configured to modify the parameters "its configuration file. And we are also in their daily work certainly will inevitably have to write a document, this work is done through a text editor, so here we choose to use Vim text editor, which is installed by default on all current Linux operating system, is a fabulous text editor .
Vim has been able to get the majority of manufacturers and user acceptance, because the Vim editor set in three modes - command mode, line mode and edit modes, each respectively and supports a variety of command shortcuts, which greatly improving the work efficiency, and after the user habits will feel quite easily in order to efficiently manipulate text, you must first find out the method of switching between the three modes of operation as well as differences mode.
command mode: control cursor movement , the text can copy, paste, delete, and find other work.

Input modes: normal text entry.

Line mode: To save and exit the document, as well as set the editing environment.

Vim commonly used commands

command effect
dd Delete (cut) the entire line where the cursor
5DD Delete (cut) 5 lines starting from point
yy Copy the entire line where the cursor
5yy Copy 5 lines starting from point
n Display search command to locate the next string
N Display search command to locate a string
in Undo the last step of the operation
p

Before deleting data (dd) or copy (yy) is attached after the cursor over

 

Line mode commands available in

command effect
:w Storage
:q drop out
:q! Force Quit (discard the changes the contents of the document)
:wq! Forced to save and exit
: Not set Show Line Numbers
:set nonu It does not display line numbers
:command Execute the command
: Integer Go to the bank
:s/one/two The current cursor row replace the first one two
:s/one/two/g All current cursor one line into two alternative
:%s/one/two/g The full text of all one replaced two
? String From the bottom of the search string in the text
/ String In the search for the text string from top to bottom

2, through the VIM editor to configure NIC
NIC is properly configured IP address is a prerequisite if two servers to communicate with each other can. In the Linux system, all files, configure network services is actually working in the editing card configuration file.
Prefix RHEL 5, RHEL 6, the configuration file is Eth card, a network card eth0 first, the second block is a card eth1; and so on. While in RHEL 7, prefix card configuration file ifcfg places to start, plus the name of the NIC card make up the name of the configuration file, such as ifcfg-eno16777736; fortunately addition to file name changes and no other big difference.
For example:
There are a name card ifcfg-eno16777736 equipment, we will configure it to boot from the start, and information of the IP address, subnet, gateway etc. manually specified, steps should be as follows:
Step 1: First, handover to / etc / sysconfig / network-scripts directory (to store the configuration file card).

Step 2: Use Vim editor to modify the card file ifcfg-eno16777736, written by one of the following configuration parameters, and save and exit. Because the hardware and architecture of each device is not the same, so readers use the ifconfig command itself that the default name of each card.

Device Type: TYPE = Ethernet

Address assignment mode: BOOTPROTO = static

NIC Name: NAME = eno16777736

Whether to start: ONBOOT = yes

IP Address: IPADDR = 192.168.10.10

Subnet Mask: NETMASK = 255.255.255.0

Gateway address: GATEWAY = 192.168.10.1

DNS address: DNS1 = 192.168.10.1

Step 3: Restart network services and network test whether China Unicom.
3, warehouse configuration YUM
Yum repositories role is to further simplify the difficulty RPM management software and automated analysis techniques required packages and their dependencies. Yum it can be imagined as a huge depot, which has saved nearly all the commonly used tools, but only need to say the name of the package required, the system will automatically do the rest.
Step substantially as follows:
Step 1: /etc/yum.repos.d/ into the directory (the directory is stored as a depot Yum profile).

Step 2: Use Vim editor to create a new configuration file called rhel7.repo (file name can be arbitrary, but the suffix must .repo), written by one of the configuration parameters in bold below and save and exit (do not write back Chinese translations).

[Rhel-media]: Yum repositories unique identifier to avoid conflicts with other warehouses.

name = linuxprobe: Yum depot name description for easy identification warehouse use.

baseurl = file: /// media / cdrom: the way include FTP (ftp: // ...), HTTP (http: // ...), local (file: /// ...).

enabled = 1: Set this source is available; 1 is available, 0 is disabled.

gpgcheck = 1: Set check whether this source file; 1 is the check, the check is not 0.

gpgkey = file: /// media / cdrom / RPM-GPG-KEY-redhat-release: If the above parameters to open the check, please specify the public key file address.

Step 3: According to the optical disc loading path configuration parameters, and write information to the disc loading / etc / fstab file.

Step 4: Use the "yum install httpd -y" command to check whether Yum repositories already available.

 

 

Guess you like

Origin www.cnblogs.com/airui/p/11913469.html