A, linux development process
① 1969 Nian unix born Bell Labs
② Gerald Tannebaum: minix unix
③ Stallman (stallman), Company: Free Software Foundation (FSF)
Project: GNU
Rules: GPL (everyone can freely propagate freely modify)
④ Stallman: 91 years to develop a linux kernel.
Second, how to choose the release of linux
(A) linux desktop
①Ubuntu (Ubuntu), developer Development Platform
② server linux system:
redhat, centos (remove redhat free software to remove Red Hat inside the log)
③ high security: debian, freedsd
④ Database Advanced Services: openSUSE
⑤ new technology, new features: Fedora (stability: Fedora "redhat" centos)
⑥ Chinese version: red flag linux, unicorn linux.
Third, corporate standard selection system
(A) classification system
centos6. , Centos7.
Official website is: Centos.org
Domestic mirror site: mirrors.aliyun.com
Mirror source explained:
LiveDVD: trial version, written to a CD, burn to disc u.
bin-DVD: used in the production.
torrent: Download seed.
(B) the difference between the median and the virtual machine system
The difference between 32-bit and 64-bit
① different design time positioning.
② to go to different installation configurations.
③ different operation speed.
④ different addressing capabilities.
Fourth, the virtual machine
On a computer, a virtual multiple computers.
(A) learning environment and recommended configuration options
Win7 / 10, intel i5 above cpu, memory 8G above, the hard disk 500G
Virtual Machine Version selection:
windows:Vmware 8.0/12
mac:vmware fusion
(B) create a virtual machine (vmware)
Create a new virtual machine - Custom - install the operating system --linux / redha / centos-- virtual machine name, virtual machine storage location (vmware) Later - processor configuration (default) - memory settings (greater than 1G) - the type of network (push nat) - disk (default) - Creates a new disk - Specifies the disk capacity (20G) - Specifies the disk location.
(C) Virtual Machine FAQ
① enough authority: Right-click Run as administrator
② Edit virtual machine configuration:
CD / DVD: Use ISO to read the file, select the location where the mirror.
③ Click on running virtual machines
Inter-vt-x does not support.
After restarting the computer -F1, F2 into safe mode:
security-vitualizaition-vitualizaition(开启)
vmware windows related service is not open:
services.msc start all vmware
(D) enterprise-class standards to install centos system
Run a virtual machine: Select
①install or upgrade an existing system
rescue installled system start rescue mode
②media found --skip
③ Select Language: English
④ Keyboard: Default
⑤ mounting hardware storage types: basic storage device
⑥hostname: centos6.9
⑦ Time zone: Shanghai
⑧ set the root password: 123456
⑨ Subdivision:
use all space use all the space
replace existing linux system to replace the existing system linux
shrink current system prior systems refine
use free space remaining space using
*** create custom layout to create a custom layout
/ Boot Boot system starts --200M
swap - 1.5 times the memory. Swap partition, use as temporary memory
/ Root partition, how much to surplus. It all started (c disc) from the root.
Click (3 partition, click 3 times): Free, select the partition, force to be primary partion. --format (format)
Select the installation of the mounting system: minmal minimized, customize now (custom)
base system:base,cmpatibility libraries,debugging tools
deveplopment:deveplopment tools
reboot (restart)
Configure the virtual machine network:
vmware Edit Virtual Network Editor: Click nat mode
(E) Linux network configuration
Network Configuration:
①setup-②network-configuration-③device conf -④eth0-⑤network configuration (remove the model, press the space bar) -⑥ok-⑦save-⑧saveandquit-⑨quit
Card configuration to take effect:
Restart card: ifdown eth0; ifup eth0
View card information: ifconfig
(Vi) xshell installation and optimization
Common Log in Log tool: xshell, secureCRT, putty
File - Properties: Personalize
Tools - Options: file storage location
Failure of the landing Troubleshooting:
ip address + port (22)
vmware three kinds of network model
① computer pc-- emperor
② virtual machine - poor people
Poor people who only concerned to allocate the house.
NAT mode:
① computer pc --- Emperor
②nat ---- prime minister
③ virtual machines --- poor people
The poor people of the house is allocated prime minister, has nothing to do with the emperor.
ip nat virtual machine is assigned, no matter how changes in computer environment, will not affect the virtual machine.
Benefits: wherever, connected virtual machines can use the same IP.
Bridge Mode:
① computer pc-- emperor
② virtual machine - poor people
If you replace the ip address will be changes in the environment, computers and virtual machines.
Only the host mode:
① computer pc-- emperor
② virtual machine - poor people
VM poor people to be controlled, and can not contact with the outside world, no Internet access.
Troubleshooting Remote Connection: Cock silk road to the center of Bath
① Check whether the road is smooth
ip address of ping server (local shell ping test)
② Does anyone robbery
③ Check whether to provide services
Local Test: telnet ip port
V. Review of knowledge
(A) the basics
Under 1.1 explain what is GPL, GNU, Free Software
GNU:GNU is not unix
Free Software: gawk, bash, gcc, cmacs
GPL: General Public License
1.2. How to choose the linux operating system release?
redhat ,centos
Several methods partitions 1.3linux make the following?
/ Boot boot partition
swap swap partition
/ Root directory
1.4 remote troubleshooting connection problems?
Use ping and telnet command to test locally: ip and port.
(B) the initial contact with linux will certainly rule
[root@centos6-kvm2 ~]#
User name, host name, current position, prompt
linux operating system commands command syntax
There must be a space between commands and parameters.
Six, linux use the command
/ Everything from the start from the root. (A diagonal direction and opposite to win)
(1) Create a directory (directory):
mkdir /data
ls #list list, displays the contents of the directory.
ls -l / data # View catalog details (tap key to auto-complete).
(2) into a directory:
cd /data
Absolute path: the path from the root, has a top /, such as: / data, / etc / hosts
Relative path: not at the root, without front /.
pwd # view the current directory location.
(3) create a file:
touch /data/oldboy.txt
ls -l / data /
(4) Edit the file contents
vim /data/oldboy.txt
Edit the file: i
Save the edited file: esc,: wq! (Q! Forced to quit without saving edits).
(5) to view the contents of the file
View and edit the contents of a file: cat /data/oldboy.txt
(6) echo command
echo hello world
Will append to the file last line :( "redirection symbol)
echo hello world >>/data/oldboy.txt
⑥ into multiple lines in the file
cat >>/data/oldboy.txt<<EOF
i
am
。。。
EOF (end of file, other symbols may be used, and can be paired above)
(7) the redirection symbol
Standard output redirection (>), and then empty the contents of a file is written.
Append redirection (>>), the contents of the file on the last line.
1 before the redirection symbol (>> 1, 1>), will be redirected to the correct content file.
Before the redirection symbol has two (2>, 2 >>), the content of the error redirected to file. (Command execution result of the error), such as: eho hello >> / data / oldboy.txt 2 >> / data / oldboy.txt. Can be abbreviated to: eho hello >> /data/oldboy.txt 2> & 1 # to information about errors that are put on.
Less than (<): input redirection
xargs # grouping command
[root@centos6-kvm2 ~]# mkdir /data
[root@centos6-kvm2 ~]# touch /data/num.txt
[root@centos6-kvm2 ~]# echo 1 2 3 4 5 >>/data/num.txt
[root@centos6-kvm2 ~]# xargs -n2 </data/num.txt
1 2
3 4
5
[root@centos6-kvm2 ~]#
Two fish number (>>):
[root@centos6-kvm2 ~]# cat >> /data/num.txt << EOF
> I AN
> STUDING
> LINX
> EOF
[root@centos6-kvm2 ~]#
(8) copy (cp)
Copy the file:
cp /data/oldboy.txt /data/num.txt
Backup:
cp /data/oldboy.txt /data/oldboy.txt .bak
Copy directory:
cp / data / temp (omitting directory ignore this directory)
cp -r / data / temp (recursive copy)
Directory replication may be: cp -a / data / tmp (-a, -pdr, copy all :-p holding properties)
(9) move the file (mv, shear)
mv /data/oldboy.txt /temp
ls -l /data/oldboy.txt
Note: vmware snapshot feature.
(10) to delete the file into the directory
cd /tmp/data
ls -l # view the contents of the current directory
rm oldboy.txt # -f, forced to delete
rm -r / data # delete a directory -r, -rf forced to delete
Note: Shortcuts
ctrl + c # exit
clear screen ctrl + l #
(11) find command
find /root/ -type f -name "oldboy.txt"
-type: type, f file, d directory
-name: name, use double quotes. Find a range: ". * Txt"
Pipe character: |, the results of previous command, the command is transmitted to the back. Pipe, and use xargs partner.
[root@centos6-kvm2 /]# find /data/ -type f -name "num.txt" | xargs ls -l
-rw-r--r-- 1 root root 28 Dec 11 00:01 /data/num.txt
[root@centos6-kvm2 /]#
(12) to exit the first level directory
cd .. # retreated to the parent directory
cd ../# retreat root directory
Note :(.) A dot represents the current directory.
(13) to delete the file fixed content
grep: Find what's row, -v, take the opposite content
[root@centos6-kvm2 /]# grep -v 'AM' /data/num.txt
The default from the former head # 10 rows, -nxx, take the first line xx.
[root@centos6-kvm2 /]# head /data/num.txt -n 2
tail: # 10 after the default line to take, -nxx, after taking xx line.
[root@centos6-kvm2 /]# tail -2 /data/num.txt
awk: filtering,! It represents negated.
[root@centos6-kvm2 /]# awk '!/OLDBOY/' /data/num.txt
sed: Filter
[root@centos6-kvm2 /]# sed '/OLDBOY/d' /data/num.txt
(14) with a single command to create a directory (multilevel)
mkdir -p / oldboy / test # -p, create a multi-level commands; -v show creation process.
(15) a known tmp test.txt file already exists, how can we execute the command /mnt/test.txt copy to tmp overwrite /tmp/test.txt, and let not prompted to overwrite (with root privileges) .
Forced: Do not prompt confirmation key
Method 1: backslash
Method 2: Use command absolute path, the full path (eg: which cp)
-i # command prompt parameter, linux alias with the -i
linux Alias: prevent dangerous commands, simplified command.
Temporary settings linux alias:
View System alias: alias cp
Configure an alias:
Rm allowed to perform the display do not rm:
alias rm='echo do not rm'
Linux permanently set the alias:
vim /etc/profile
alias rm='echo do not rm'
source / etc / profile # to take effect.
Move the cursor to the last line: G
Move the cursor to the first line: gg
Insert the next row line of the cursor position, and enter the edit mode: o
In vim /root/.bashrc there: rm, cp, mv -i alias, if you want to modify, you need to comment out this file aliases.
Command before adding, canceled alias.
(16) remove a row or more rows
But -n '20p' /data/num.txt
Remove all sed default content, -n parameters, remove only the selected content.
[root@centos6-kvm2 /]# sed -n '10,15p' /data/num.txt
[root@centos6-kvm2 /]# sed -n '10p' /data/num.txt
a combination of head + tail:
[root@centos6-kvm2 /]# head -15 /data/num.txt | tail -5
awk:
[root@centos6-kvm2 /]# awk 'NR==10,NR==15' /data/num.txt
1
1
1
1
4
[root@centos6-kvm2 /]# sed -n '10,15p' /data/num.txt
1
1
1
1
4
[root@centos6-kvm2 /]#
summary:
Remove the file a line 1
awk: Three Musketeers of the youngest, to take good column, NR line number.
sed: trio of second, taking the line, with the use of the p. -n cancel the default output
'10p','10,15p'
head + tail thereof.
grep -A10, find and display the contents of the next line.
(17) replace paperwork
Find file
find /data/ -type f -name '*.text'
The contents of the file oldboy replaced oldgirl
[root@centos6-kvm2 /]# sed -i 's#OLDBOY#OLDGIRL#g' /data/num.txt
The find command to find the content behind the command processing
[root@centos6-kvm2 /]# find /data/ -type f -name num.txt | xargs sed -i 's#OLDBOY#OLDGIRL#g' /data/num.txt
Note: linux command help, man command