(. 1) Vim, VI; Sed
VI, Vim, <-----> Sed (text editor)
Sed (stream processing non-interactive text editor)
VI, Vim (interactive text editor)
(2) why use vi, vim
many linux text processing tools (Vim, VI, Emacs)
A. A unix system vi, vim
B. Dispatching program
[the root @ localhost ~] # the visudo
[the root @ localhost ~] # the crontab -e
C. the ability to edit a program, can identify the color of
[the root @ localhost ~] # Music Videos Anliu the vimrc .vimrc-
D. procedure is simple and fast
(3) vim three modes (command mode, insert mode, the last line)
Naming scheme ---- i, o, O, A , a ----> insert mode
<-------- ESC -----------
------------ Command Mode: -------> last line
<----------- ESC ------------ -
Command Mode:
page: pgup, pgdn, ctrl + F , B
cursor movement:
arrow keys; h ---> left; j ---> lower; k ----> on; ----- L > Right
w: next header word
E:
B:
Inline: the first trip home, ^, 0
to the end of the line end, $
Between the lines: the first line gg, 1G
to the line, nG
to the last line, G
Delete: Delete a single character x, del
cursor to delete rows, dd
delete multiple rows, 3dd
Copy, paste
YY, 3yy
P (lower), P (on)
Find
/ word (from the top)
? word (from bottom to top)
n-: view from front to back to find out the content of
N: Previous View to find out from the content
Insert mode
i, I: i ---> inserted before the cursor, I ---> in the first line of the cursor line
a, A: a ---> inserted after the cursor, A ---> at the cursor line end of the line
o, O: o ---> inserted at the cursor next line, O ---> cursor line
Line mode
: 15 15 Line Jump
: W
: Q
: WQ
: W!
: Q!
: WQ!
: ~ E / filename open filename Editor
: r ~ / filename read
: w ~ / filename saved as
replacement
: s / SUMMARY first match old / new cursor line
: s / old / new / g all matches cursor line
: 2,5 s / matches the first old / new line 2,5
: 2,5 All matches s / old / new / g 2,5 rows
:% s / old / new / g matches all (full text)
: S / Old / new new / C interaction
(4) vim command to open the file
+15 filename Vim
Vim + filename
Vim + / # error filename matches the first line under the cursor
(5) Basic Operation
v: character-selected from
V: row select
ctrl + v: Block
Repeat last operation
u: Undo
ctrl + r: undo the last revoked content
(5) the last line mode configuration
~ / .viminfo ----> vim history of the last line command
~ / .vimrc -----> vim configuration file
Compression and decompression
(1)zip,unzip
zip filename.zip file
zip -r filename.zip dir
zip -m filename.zip file
zip filename.zip dir -x file
zip -d filename.zip file
unzip filename.zip
unzip fillename.zip /root/
unzip -n filename.zip /root/
unzip -o filename.zip /root/
unzip -v filename.zip
(2) the gzip, gunzip
the gzip *
the gzip -R & lt / Test files in the directory # compressing
the gzip -d
[@ Server01 the root Test] -l test2.gz the gzip #
[@ Server01 the root Test] # -dv test2.gz the gzip
(3)bzp2,bunzip2
bzip2 compressed file, delete the source files.
The compressed file called XXX.bz2 exist, when compressed again, there is no prompt file, no compression; to achieve compression, add the parameter -f force compression.
.Bz2 file name is not the end of the post-compression, compression again, not content output has been compressed.
[root@server01 test]# bzip2 -d test3.bz2
bzip2: Output file test3 already exists.
[root@server01 test]# ls
123.out 1.zip 456.out dir1 dir2.zip test1 test1.zip test1zip.zip test2 test2.zip test3 test3.bz2 test3.zip test4 test5
[root@server01 test]# cat test3
[root@server01 test]# bzip2 -df test3.bz2
[root@server01 test]# cat test3
this is a test of test3
[root@server01 test]# bzip2 -dv test3.bz2
test3.bz2: done
[root@server01 test]# bzip2 -v test2
test2: 0.448:1, 17.867 bits/byte, -123.33% saved, 30 in, 67 out.
[root@server01 test]# bzip2 -t test2.bz2
[root@server01 test]# bzip2 -tv test2.bz2
test2.bz2: ok
[root@server01 test]# bzip2 -k test3
(4)xz,unxz
Archive (packaged)
(1) tar
tar XF exam.tar; RM -rf exam.tar # unzip and remove the source file
(2) cpio
Software Installation
(. 1) RPM
a.yum (time de-dependency)
arranged yum source
configured network source (basic): a station address to find the network mirror (yum domestic source: YORK yum source 163, the installation method see: http: / /mirrors.163.com/.help/ (I recommend)
USTC yum source, the installation method View: HTTPS: //lug.ustc.edu.cn/wiki/mirrors/help
yum source of sohu, installation view: http : //mirrors.sohu.com/help/
Ali cloud yum source, the installation method View: http://mirrors.aliyun.com/repo/ (recommended)
yum source Tsinghua University, Installation view: https://mirrors.tuna.tsinghua.edu.cn/
Zhejiang yum source University, installation view: http://mirrors.zju.edu.cn/
yum source China University of Science and Technology, installation view: http://centos.ustc.edu.cn/)
b configuration: downloading down .repo files on /etc/yum.repo.d/
c clean up and regenerate the cache yum clean all;. yum makecache
Configure the network source (epel): EPEL full name Extra Packages for Enterprise Linux. EPEL Fedora is built by the community for derivative distributions such as RHEL and
provide high-quality package of projects CentOS, Scientific Linux and so on. Installed after the EPEL, the equivalent of adding a third-party source.
Method One: Find epel-release basis from a source inside. yum list | grep epel-release
installation epel-release package. yum install -y epel-release
after the installation is completed, the two generating /etc/yum.repo.d/ epel.repo;. epel-testing.repo
clean and rebuild the cache yum clean all; yum makecache.
Method 2: Get on the mirror: wget https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
installation: yum install epel-release-latest -7.noarch.rpm
installed then, in /etc/yum.repo.d/ will generate two epel.repo;. epel-testing.repo
clean up and regenerate the cache yum clean all; yum makecache.
Local source configuration: Method a: mount the CD
is first necessary to mount the mirror drive put
the CD-ROM device mounted in / media; mount / dev / sr0 / media
write profile at /etc/yum.repo.d/ :
[myrepo]
name = ""
baseurl = File: /// Media
gpgcheck = 0
Enabled = 1
persistent mount: echo "mount / dev / sr0 / media" >> /etc/rc.local
clean up and rebuild the cache yum clean all; yum makecache.
Method two: the mirror mount
Method three: Using tfp or http
Source Configuration official website:
nginx: HTTP: //nginx.org/en/linux_packages.html#RHEL-CentOS
MySQL: HTTPS: //dev.mysql.com/downloads/file/ the above mentioned id = 489 467?
b.rpm mounting (not releasing a disposable type)
RPM -ivh ZIP mounting
l, q, e, R, f, F, U
(2) Source Installation
Step: Installation depends, GCC, GCC-C ++, the make, GCC-G77
[Server02 yum.repos.d the root @] ++ # yum GCC GCC-G77-C the install the make GCC
Step: Environmental Analysis , tuning system
(omitted)
third step: Download Source package
http://nginx.org/download/
Step four: Install
the Rings: The precompiled ------ "Compile -------" Installation
Create an installation directory:
mkdir -p / opt / the Data / nginx /
create a user to run software
groupadd nginx
useradd -g nginx nginx
precompiled
./configure --prefix = / opt / data / nginx / --with-http_stub_status_module - -with-http_ssl_module
wean
yum the install PCRE
yum the install PCRE devel-
pre-compiled re
./configure --prefix = / opt / data / nginx / --with-http_stub_status_module --with-http_ssl_module
contacting dependent
yum install openssl
precompiled again
. / configure --prefix = / opt / data / nginx / --with-http_stub_status_module --with-http_ssl_module
contacting dependent
yum install openssl-devel
precompiled again
./configure --prefix = / opt / data / nginx / --with -http_stub_status_module --with-http_ssl_module
Check the pre-compiler is successful, 0 successful Non-zero failure
echo $?
Compile
the make
echo $?
Installation
the make install
echo $?
Start program into the installation directory
cd / opt / the Data / nginx / cd sbin
./nginx
Viewer process
ps -ef | grep nginx
Modify the static pages
cd HTML /
vim index.html
Turn off the firewall
systemctl STOP firewalld
setenforce 0
Access page:
http://192.168.42.202/