##################################################################################################### #3
/boot storage System boot the necessary files, including the kernel, boot configuration.
/bin/sbin store various command programs
/dev Storage of hard disk, keyboard, mouse and other device files
/etc store various systems and configuration files for various programs
/root/home administrator root, and home directory for ordinary users
/var store log files, mail directories, and frequently changing files
/PROC storage of mapped data in memory, no disk usage
/tmp store Some temporary files during operation of the system 3
############################################################################################
Permissions to modify a document: The value of permissions
Basic permissions:
Read=4
write=2
X=1
[Email protected] ~]# mkdir/test01
[Email protected] ~]# ls-ld/test01
[Email protected] ~]# chmod 007/test01
[Email protected] ~]# ls-ld/test01
Special permissions:
Suid=4
sgid=2
Sticky bit=1
[Email protected] ~]# chmod 4005/test01
[Email protected] ~]# ls-ld/test01
D--s---r-x. 2 root root 6 November 09:25/test01
#########################################################################################################
Historical command
? Manage/Invoke commands that have been executed
–histroy: View a list of history commands
–history-c: Empty History command
–!n: Executes the nth command in the command history
–!STR: Performs the most recent history command beginning with Str
? Adjust the number of history commands
[Email protected] ~]# Vim/etc/profile
histsize=1000//Default record 1000 article
[Email protected] ~]# history-c
[Email protected] ~]# history
[Email protected] ~]# cat/etc/redhat-release
[Email protected] ~]# hostname
[Email protected] ~]# history
[Email protected] ~]#!cat
#########################################################
? Du, the space occupied by the statistics file
–du [Options] ... [directory or file] ...
–-s: Only the total amount of space occupied by each parameter is counted
–-h: Provides readable capacity units (K, M, etc.)
[Email protected] ~]# du-sh/root//home//etc/
? Date, view/adjust system date Time
–date +%f
–date + "%y-%m-%d%h:%m:%s"
–date-s yyyy-mm-dd HH:MM:SS "
[Email protected] ~]# date +%y%m%d
[Email protected] ~]# date +%y-%m-%d
[Email protected] ~]# date +%f
[[email protected] ~]# date-s "2017-11-11 9:46"
#########################################################
Customizing the Yum Repository
1. Numerous RPM packages that transfer real-world software packages to virtual machines via SCP
Real-Machine Operation:
#scp-R tools [email protected]:/
Virtual machine operation:
2. To create a repodate warehouse data file:
#createrepo/tools/other
#ls/tools/other///view Repodate warehouse data files are generated
#ls/tools/other/repodate//production see the contents of the document
3. Writing client, specifying a new warehouse source
[Email protected] ~]# Vim/etc/yum.repos.d/dvd.repo
[DVD]
Name=dvd
Baseurl=http://192.168.4.254/rhel7
Enabled=1
Gpgcheck=0
[MYRPM]
name=myrpm
Baseurl=file:///tools/other
Enabled=1
Gpgcheck=0
[email protected] ~]# Yum repolist
#####################################################################################################
[Email protected] ~]# yum-y install Cmatrix
[Email protected] ~]# rpm-q Cmatrix
Query RPM Package Installation Checklist
[Email protected] ~]# RPM-QL Cmatrix
[Email protected] ~]# Cmatrix
[Email protected] ~]# CMATRIX-C Red
[Email protected] ~]# Oneko & #放入后台
[Email protected] ~]# killall Oneko #杀掉所有的oneko程序
##################################################
Zip archive tool, cross-platform compression tool
? Archive + Compress operations
–zip [-r] backup file. zip Archive Document ...
[Email protected] ~]# zip-r/opt/test.zip/boot//etc/passwd
[Email protected] ~]# ls/opt
? Release Archive + unzip operation
–unzip backup files. zip [-D destination Folder]
[Email protected] ~]# unzip/opt/test.zip-d/mnt/
[Email protected] ~]# ls/mnt
[Email protected] ~]# ls/mnt/etc
[Email protected] ~]# Ls/mnt/boot
#########################################################
Vim Text Editor
[Email protected] ~]# cp/etc/passwd/opt/test
[Email protected] ~]# vim/opt/test
Command mode operation
Cursor Jump
Home key or ^, number 0 jump to beginning of line
End key or "$" key to jump to end of line
PgUp key, PgDn key page UP, PAGE Down
1G or GG jump to the first line of the file
G jump to the end of the file line
Copy and paste
Copy yy, 5yy copy one line at the cursor, 5 rows
Paste p after pasting at the cursor
X or delete key to delete a single character at the cursor
DD, 6DD Delete one line at the cursor, 6 rows
d^ removed from the cursor to the beginning of the line
d$ Delete from cursor to end of line
U undo
Find/Undo/Save
/word backwards to find the string "word"
N, n jumps to the back/previous result
U undo the most recent operation
Ctrl + R cancels the previous undo operation
ZZ Save changes and exit
Last-row mode operation
: R/etc/filesystems read into other file contents
[Email protected] ~]# echo 123 >/opt/1.txt
[[email protected] ~]# echo ABC >/opt/2.txt
[Email protected] ~]# Vim/opt/2.txt
: R/opt/1.txt
: r/etc/passwd
: R/etc/redhat-release
String substitution
: S/old/new replaces the first "old" of the current line
: S/old/new/g replaces all "old" of the current line
: N,ms/old/new/g replaces all "old" on line n-m
:%s/old/new/g replaces all "old" in the file
: S/root/admin replaces the first "root" of the current line
: S/root/admin/g replaces all "root" of the current line
: 1,10s/root/admin/g replaces all "root" of 第1-10 line
:%s/root/admin/g Replace all root in file
################################################
: Set NU|NONU display/Do not display line numbers
: Set AI|NOAI Enable/disable auto indent
#################################################
Modify the configuration file to set VIM pre-executed actions
[Email protected] ~]# VIM/ROOT/.VIMRC
Set Nu
Set AI
##################################################
? ln, creating a soft connection (shortcut)
# ln-s/etc/sysconfig/network-scripts/ifcfg-eth0/opt/eth0
# ls/opt/
# ls-l/opt/eth0
# Cat/opt/eth0
# ln-s/ETC/REDHAT-RELEASE/OPT/RH
# ls/opt/
# CAT/OPT/RH
I node: number identifies the storage space of the hard disk
? ln, creating a soft connection
Soft Connect--the original document--I-node--document data
? ln, creating a soft connection
– Soft Connect--the original document--I-node--document data
–ln-s original file or directory soft connection file
If the original file or directory is deleted, the connection file will be invalidated
Soft connections can be stored in different partitions/file systems
? LN, creating a hard connection
– Hard Connect-I-node-to-document data
–ln RAW file Hard connection file
If the original file is deleted, the connection file is still available
Hard connections with original files must be in the same partition/file system
[Email protected] ~]# rm-rf/opt/*
[Email protected] ~]# echo 123 >/opt/a
[Email protected] ~]# cd/opt/
[email protected] opt]# cat A
[Email protected] opt]# ln-s/opt/a/opt/a1 #软连接
[[email protected] opt]# ls
[Email protected] opt]# ln/opt/a/opt/a2 #硬连接
[[email protected] opt]# ls
[email protected] opt]# CP A A3 #复制
[[email protected] opt]# ls
[Email protected] opt]# ls-i #只有硬连接不会产生新文件
[Email protected] opt]# rm-rf/opt/a
[[email protected] opt]# ls
[email protected] opt]# cat A1
CAT:A1: No file or directory
[email protected] opt]# cat A2
[email protected] opt]# cat A3
#####################################################
System Environment variables
Path: Provides a search path for the command program
Prompt command not found?
1. Wrong order
2. Command not installed
3. The program of the command, not in the path value
[Email protected]/]# Vim/opt/hello
#!/bin/bash
echo ' Hello World '
[Email protected]/]# chmod +x/opt/hello
[email protected]/]# Hello #运行失败
[Email protected]/]# echo $PATH
[Email protected]/]# ln-s/opt/hello/usr/bin/hello
[email protected]/]# Hello #运行成功
######################################################
Source Package Compilation Installation
? Key Benefits
– Get the latest version of the software to fix bugs in a timely manner
– Software features can be selected/customized on demand, with more software to choose from
– Source package for various platforms
RPM Package: RPM Yum Run installation
GCC, make make, install
SOURCE Package-------------------> can execute program------------------------> Run Installation
Step 1: Install GCC, make
[[email protected]/]# yum-y install gcc make
[Email protected]/]# rpm-q gcc
[[email protected]/]# rpm-q make
Step 2:tar Unpacking, releasing the source code to the specified directory
# rm-rf/opt/*
# tar-xf/tools/inotify-tools-3.13.tar.gz-c/opt/
# ls/opt/
# All the following steps are to be performed in the Unzip directory
Step 3:./configure configuration, specify options such as installation directory/function module
# cd/opt/inotify-tools-3.13/
#./configure--prefix=/mnt/myrpm
Step 4:make Compile, build the executable binary program file
# make
Step 5:make Install, copy the compiled files to the installation directory
# make Install
# ls/mnt/myrpm/
##########################################################
Get command help, man help
5: Help information for text files
[email protected]/]# man passwd
[[email protected]/]# man 5 passwd
The "--help" help option is typically provided
#########################################################
Add:
Absolute path to the Wc-l file #统计文件有多少行
1. Please count the number of Linux users?
[Email protected]/]# wc-l/etc/passwd
43/etc/passwd
2. In the statistics/etc directory, how many files end with ". conf"? (does not contain subdirectories)
[Email protected]/]# Ls-l/etc/*.conf | Wc-l
3. In the statistics/etc directory, how many files end with ". conf"? (Contains subdirectories)
[Email protected]/]# find/etc-name "*.conf" | Wc-l
Find option
-mtime +|-Modified Days
[Email protected]/]# find/var/log/-mtime +1000 #1000天之前
[Email protected]/]# find/var/log/-mtime-10 #最近10之内
######################################################
View Network link Information
Netstat-anptu
-A: List all processes
-N: Displayed in digital form
-P: Process name and PID information
-T:TCP Connection
-U:UDP Connection
####################################################
Host name and IP address mapping relationship/etc/hosts (DNS resolution) only provides parsing for native computers
[Email protected]/]# Tail-2/etc/hosts
192.168.4.7 svr7.tedu.cn
192.168.4.10 haha.tedu.cn
[[email protected]/]# Ping svr7.tedu.cn
[[email protected]/]# Ping haha.tedu.cn
####################################################
Several extensions of applications, vim editing techniques, distribution network yum source, source code compilation installation