1.2 to the general user authorization
root user
Modify / etc / sudoers file, the file is very important and can not be altered
vim /etc/sudoers
If you want to give permission to the user, we want to use this command
visudo # to enter the edit
After modifications are complete, we need to reload this file, use the command
source /etc/sudoers
1.3 Creating a User
# useradd username to create user
passwd user name # configure user password
1.4 Creating user groups
groupadd group name
1.5 user and group related files
/ etc / shadow # store user passwords
/ etc / passwd # store user name
/ etc / group # storage group name
ID ordinary users and groups are created manually from the beginning of 1000
root user has permission supreme caution !!!!!!
2. File and directory permissions (a) (important index )
2.1 Detailed file permissions:
For ordinary files for:
r read files
w can write or edit a file
x can be executed For a directory r can view the contents of the file w can create and modify file or folder x represents can enter the directory
- General documents
d folder
l flexible connection (shortcut)
B block device, file-based storage medium
c represents a keyboard, mouse, and other equipment
Methods 2.2 executable file
./ filename
Example: ./tiger.sh
2.3 Configuration permissions:
chmod u + r tiger read access to the user to add
chmod u + w tiger add to the user-writable
chmod u + x tiger execute permission to the user to add chmod g + r tiger added to the group-writable chmod g + w tiger added to the group-writable chmod g + x tiger added to the group-writable chmod o + r tiger added to others read permission chmod o + w tiger added to others write permission chmod o + x tiger to others Add execute permissions
2.4 Permissions and digital conversion (important index * ):
2.3 modify command authority:
2.3.1 chmod modify permissions
chmod 777 yueqing.sh
2.3.2 chown modify the owner and group
the root yuanxin.sh chown
# the following two commands are the same effect:
chown the root: the root yuanxin.sh
chown root.root yuanxin.sh SU - # switch user Alex
2.3.3 chgrp modification is a group
chgrp xiaopan yuanxin.sh # modification is a group
3. soft links (important index )
We will later install python interpreter, it will use soft links
Python3 installation, in order to be able to enter directly into the python3 interpreter, you need to configure the environment variables
3.1 Configuration Environment Variables
echo $ PATH # View environment variable
/ usr / local / sbin: / usr / local / bin: / usr / sbin: / usr / bin: / root / bin
3.2 add soft links
ln -s /opt/python3.6/bin/python3 /usr/bin/python3
ln -s /opt/python3.6/bin/pip3 /usr/bin/pip3
4 tar compression decompression command (important index * )
4.1 Parameter Description
-z to use gzip compression tool
-x-extracting file
-v Show Details
-c archive
-f specifies the file
4.2 compressed file command
tar -cf filename
4.3 unzip the file command:
tar -xvf filename
4.4 further compression (tar focus) by gzip command
tar -zcvf compressed file compressed file filename #
tar -zxvf extract the filename .tar.gz file #
Get to optall.tar.gz file suffix
4.5 decompression of two ways:
4.5.1 Method One
The first step to using gzip command unpack, remove the .gz suffix, give the file optall.tar
gzip -d filename
And then to extract the tar
tar -xvf optall.tar
4.5.2 Method 2 (recommended)
Direct use of disposable tar command to decompress
tar -zxvf filename
tar -zxvf optall.tar.gz #-time decompression
4.6 history show history command this (episode):
history show history command now 316 RM -rf qishi3 rh root666 xiaolu.sh zhiwu.jpg 317 LS 318 gzip -d optall.tar.gz 319 LS 320 tar -xvf optall.tar 321 LS 322 RM -rf optall.tar 323 LS 324 tar -zcvf optall.tar.gz *
Use! + Serial number can call this command
! # 316 can execute rm -rf qishi rh root666 xiaolu.sh zhiwu.jpg command
5 netstat command (important index * )
Check the server's port information
netstat -tunlp
netstat -ntlp
Server port range: 0 to 65535 25 and port 110 is a mail server 3389 windows remote desktop port 21 FTP port 22 SSH of 23 is Telnet 53 is the DNS port 67/68 DHCP protocol port 3306 mysql ports ports 139 and 445 windows a shared document 6379 redis port 80 HTTP hypertext transfer protocol port 443 HTTPS 8000 Django default port 5000 flask default port
6 ps command (important index * )
See ps -ef server information above process, the pipe fitting may break or grep Filters
7 KILL command (important index * )
kill command: End Process command
kill -9 process ID
pkill process name # support regular match
8 SELinux functionality (important index * )
View selinux state
getenforce
Temporarily closed
setenforce 1/0
Selinux permanently closed
Modify the configuration file
vim /etc/selinux/config
修改SELINUX=disabled
9 iptables firewall (important index * )
iptables -L View firewall rules
iptables -F empty firewall rules centos7 default firewall has been used as a firewall
Turn off the firewall
systemctl status firewalld # View firewall status
systemctl stop firewalld # turn off the firewall
systemctl disable firewalld # turn off the firewall boot
systemctl is-enabled firewalld # start checking whether the firewall
11 tree command (important index *)
Threaded directory and subdirectory
You need to install before you can use
yum install tree
12 DNS (important index * )
Domain Name System DNS (domain name system)
12.1 DNS works
1 we want to visit www.baidu.com , we will first go to the local DNS cache lookup
2 If the local DNS cache is not, then go to the local hosts file to find file
3 If the local hosts file does not, DNS server, it will go to the public network to find
4 If the DNS server on the public network is not, then, will go to 13 DNS root servers around the world to find
5 If the 13 DNS root servers did not, it means this domain name is not registered, there is no way to access
12.2 commonly used domestic DNS server:
Telecom DNS server
202.96.134.133
202.96.134.33
202.96.128.86
202.96.128.166
202.96.134.166
114DNS server
114.114.114.114
Google DNS server
8.8.8.8
Ma's DNS server
223.5.5.5
223.6.6.6
Teng twist
119.23.23.23
12.3 nslookup use
Dns method of modifying at 12.4 linux
vim /etc/resolv.conf
nameserver 223.5.5.5
nameserver 119.23.23.23
13 linux scheduled task crontab (important index ***)
13.1 Open the configuration file
vim /etc/crontab
* * * * * Run
timeshare weeks sun and the moon
13.2 Example:
# Command once per minute
* * * * *
* / 1 * * * * 3,15,35 minutes per hour of Run # 3,15,35 * * * * Run # 8-11 am the third and 15 minutes to perform 3, 15 8-11 * * * echo "the Hello world" # night 21:30 Run 30 21 * * * systemctl restart Network # whole day 3:00 back up the database 03 mysqldump * * * # every Saturday, 1:30 am Run day 301 * 6,7 * Run # Monday to Friday 1:00, empty the / tmp directory of all the files * 1 * RM 1-5 -rf * / tmp / * # night 21:30 restart Nginx 30 * * * 21 is the restart Nginx systemctl # 1 month, 10, 22 4:45 restart the Nginx 45. 4 1,10,22 * * systemctl restart nginx
# 3, and 15 minutes each command execution Monday 8:00 to 11:00
3,15 * 8-11 * 1 Run # 6 o'clock every day backup mysql database 06 * * * Backup database
14 package (important index ***)
14.1 windows following packages is what format
.exe and .msi
mac below
.dmg
linux under
rpm
14.2 If we want to install nginx, redis mysql, we should use these packages
mysql-5-3-4.rpm
redis-3-4-3.rpm
nginx2-3-2.rpm
15 yum tool (important index * )
15.1 RPM principle
Can be automatically downloaded from the server specified RPM package and install, can be handled automatically dependencies and install all dependent packages **
15.2 yum configure a custom source
15.2.1. A good habit, yum backup source
/etc/yum.repos.d cd
mkdir repo_bak
MV .repo repo_bak * /
15.2.2. Download Ali cloud repo file
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O http /etc/yum.repos.d/epel.repo : //mirrors.aliyun.com/repo/epel-7.repo
15.2.3. Empty yum yum cache and generates a new cache
yum clean all yum makecache
15.2.4. Installing software extensions source
yum install -y epel-release
17 Screensaver software hackers
https://www.cnblogs.com/tiger666/articles/10331625.html
18 System Management Services command
Before Centos6
service network restart
service network start
service network stop
service network status
After Centos7
systemctl restart network
systemctl start network
systemctl stop network
systemctl status network