Supplementary vi commands, network configuration
A. Configure network conditions
on the same network
connection tool
ifconfig -h command to get help information
pipeline: the last command output as input to the next command (next command) ifconfig -h | more
the IP address of the target host ping: communication network test commands
connection mode of the virtual network machine. Click the virtual machine console - Settings - Network adapter.
Connection mode:
Bridge: Communication between the host machine and the virtual real network
only host: physical isolation network, a local area network.
NAT: virtual machine access to the Internet, as long as the real host access to the Internet.
storage path: cd / etc / sysconfig / network -scripts
card configuration file named: ifcfg-NICNAME (NIC name eth0) the ifcfg-eth0
2. File Content: DEVICE = eth0 device name
TYPE = Ethernet network type
ONBOOT = yes whether to enable the network interface card
BOOTPROTO = none IP configuration mode, if you use a static ip is none, if DHCP is the way, the value dhcp
IPADDR = 172.16.1.2 ip address configuration
take effect: ifdown eth0 ifup eth0
or restart / etc / init .d / network restart
to view the file vi /etc/init.d/network
III. Troubleshooting network
1. In the same network segment
IP address checking Windows and Linux, (the ipconfig Windows) (Linux the ifconfig)
128 64 32 16 2. 8. 4. 1 binary
172.16.1.1 172.16.0.0
10.1.1.1 10.1.0.0
10.1011 million 00010000 0000000100000
1,111,111,111,111,111 00000000 00000000 and (1 full 1)
------------------------------------ ----------------------
1,010,110,000,010,000 00000000 00000000
summary: the same ip address the top three, as the same network segment
2 with a switch
3. test command the ping
4. determine whether the service is open
1) View all processes ps -aux
to see ssh process ps -aux | grep "ssh"
filter: grep
2) check the service status: service startup script to use to view the service status, usually in /etc/init.d script file has every service installed.
3) to remotely view the corresponding service is running telnet
syntax: telnet destination host IP port number (if not open, open the corresponding service or firewall rules).
IV. Supplementary vi command
1. Basic command
pwd locate the current position (inverted tree structure)
CD Change directory
cat view contents of
ls / root directory view
ls sideways row shows, the full line shows the next line is then
ls -l row shows only details of a file or directory
mkdir ambow create a folder ambow (later can take a plurality of folder names)
mkdir ambow {1..10} regular expression, while creating more suffixes 1 to 10 folder
/ b / c / d to create a multi mkdir -pa folders
command syntax
command option parameter
ls -a view hidden folders (prefix yes.)
2. Copy and paste the file directory
cp copy
cp -r ambow / / tmp / directory with a copy -r
cp copy files for FFFFF for
3. View files
cat View of small files
first few lines (default 10 lines) to view files of head
head -3 text view files first three lines of
tail after -3 text file to view the three lines
more text.txt view large files, press enter cd .. translated
into the more, enter "/ + search name" search. n repeat next search key quit away.
4. Move the cursor
n enter: Move the cursor down n lines.
\ $: The cursor jumps the cursor trekking tail.
^: The cursor jumps the cursor trekking first.
gg: Move the cursor to the first line of the file.
G: Move the cursor to the last line of the file.
The copy and paste
1) yy copy of the line cursor (common)
NYY is n-number. Copy cursor down n rows, e.g. 20yy 20 is copied row (common)
P Paste
2) Copy select
a) locating the position of the cursor to want to copy
b) v pop-up cursor key, use the arrow keys to select the contents of the copy range
c) Copy Type y
d) positioning the cursor to the position of the pasted
e) p type paste
6. Remove
delete a row: dd
delete all the data of the cursor to the last line: dG
delete the cursor location first row: DGG
delete a character: x
delete the cursor position to the end of the line: d \ $
erasure position the cursor to the beginning: D
7. the replacement
replace single letters: r
character position where the alternative: R esc end
repeat undo
undo: u revocation reply: ctrl + r
repeat the operation:
9. line mode
to save and exit: wq
copy and paste: 2,3 co 5 copy 2-3 row to row 5
delete: n1, n2d will n1, n2 rows deleted
cursor jumps to the first line:: 1: n: G
at 10. vi simultaneously deleting a plurality of replacement strings
:% s / qq / ww ww qq replace all of the rows
:% s / 111 replace 111 is empty of all rows
1) is non-% the current line
string n 2) the substitution of the n-th row to the last line, $ s / string
11. Queries character length
echo -n "name" | (. -N to avoid echo add an extra newline) wc -c count the number of "name" field character
cat users.sh | wc -c statistics uers.sh file character number
13. more, less command
space page down, + Enter key number from this row represents the n-th row
more = see row number
less longitudinal direction keys to view the text
can be done tab to view the contents of the file, except that the support less space up and down keys to view content, and supports the contents of the page up view already seen, more but can only be turned down, you can not turn forward.
Note: These are just some common commands, refer to the detailed study https://www.runoob.com/linux/linux-vim.html