1. Disk partition format:
MBR: Up to 4 partitions with a maximum capacity of around 2.2T
GPT: Up to 128 primary partitions
2. File system:
EXT3/4: Suitable for small files
XFS: Suitable for large files
3. Disk partitioning: Minimum of 1 partitions required to install Linux
/boot/home/var (generally separate partitions)
4. PS1 settings used by the command line prompt
[[email protected] desktop] #export ps1= ' [\[email protected]\t \w]\$ '
[[Email protected]:50:28 desktop] #export ps1= ' [\[email protected]\h \w]\$ '
5. List kernel versions
[[email protected] desktop] #uname-R
3.10.0-327.el7.x86_64
6. View the files and sort them by time
[[email protected] desktop] #ls-lt
[[email protected] desktop] #ls-ltr (flip time sort)
7. Classification of commands
Internal command: Operating system with inherent functionality, no file correspondence
External command: must correspond to command file
[[email protected] desktop] #type ls
LS is an alias of ' LS--color=auto '
[[email protected] Desktop] #type CD
The CD is a shell embedded
[[email protected] Desktop] #enable list internal commands
8.touch Create a file or change the timestamp (if the file already exists)
9. Configure temporary addresses
[[email protected] desktop] #ifconfig eth0 192.168.6.8/24 up
10. Network Card Configuration file location
/etc/sysconfig/network-scripts/
11. Package Management
http://mirrors.163.com/
http://mirrors.aliyun.com/
12. Find Files
[[Email protected] ~] #find/boot/-size +5m files larger than 5M
[[Email protected] ~] #find/boot/-size +5m-exec cp {}/opt/\;
[[Email protected] ~] #find/opt/-mtime +10 #10天前修改过
[[Email protected] ~] #find/opt/-mtime-2 #2天内修改过
13. Find files using locate (fast, imprecise)
[[Email protected] ~] #locate vmlinuz
[[Email protected] ~] #updatedb # Update the database used by locate
14. Find the contents of a file
15. Input redirection
16. End tag
17. Compressing files
[[Email protected] ~] #gzip initial-setup-ks.cfg Compressed file
[[Email protected] ~] #gzip-D initial-setup-ks.cfg Unzip the file
[[Email protected] ~] #cp-R/etc/security//opt/
[[Email protected] ~] #cd/opt/
[[email protected] opt] #gzip security/#gz不能压缩目录
[[email protected] opt] #tar CF Security.tar security/packaged, not compressed
[[email protected] opt] #gzip Security.tar compression
18. View File types
19. No pressure, only view the contents of the compressed package
20. Periodic execution of tasks
[[email protected] opt] #crontab-E
command is executed 05 minutes per hour.
The command is executed 15:05 every day.
1 command per month 1th number 15:05 executed
1 3 Command executed every March 1 15:05
2 Command 2 of 15:05 executions per week
/5 8-18 * 1,3,5 command between 1358 to 18 points per week, every 5 minutes
21. File types
- Represents a normal file, D represents a directory, L represents a linked file, B represents a block file, and C represents a character device
22.suid: The program or command is run in the owner's capacity
command, program has identity during run time
[[email protected] root] $ls/root/Not enough permissions
[[Email protected] ~] #chmod u+s/usr/bin/ls
[[email protected] root] successfully executed $ls/root/
23.sgid: Inherit the parent directory of the genus Group
[[email protected] root] $ls/root/
[[Email protected] ~] #chown. bob/tmp/demo/Change Directory Genus
[[Email protected] ~] #ll-D/tmp/demo/
[[Email protected] ~] #cp/etc/passwd/tmp/demo/
[[Email protected] ~] #ll/tmp/demo/#passwd属组仍为root
[[Email protected] ~] #chmod g+s/tmp/demo/
[[Email protected] ~] #ll-D/tmp/demo/
[[Email protected] ~] #cp/etc/hosts/tmp/demo/
[[Email protected] ~] #ll/tmp/demo/# The hosts group changed to Bob
24.sticky bit users can only delete their own files
[[Email protected] ~] #ll-D/tmp//var/tmp/
[[email protected] root] $echo ' Hello Tom ' >/var/tmp/tom.txt
[[Email protected] ~] $echo ' Hello Bob ' >/var/tmp/bob.txt
[[Email protected] ~] $RM/var/tmp/tom.txt failed
[[Email protected] ~] $RM/var/tmp/bob.txt Success
25. Disk Management
[[Email protected] ~] #parted/dev/vdb
(parted) Mklabel GPT
(parted) Mklabel pimary 1M 2G
(parted) Print
(parted) Mklabel primary 2G 5G
(parted) quit
[[Email protected] ~] #lsblk
[[Email protected] ~] #parted/dev/vdb
(parted) Print to find the end point of the previous partition 5000MB
(parted) Mkpart primary 5000M 20%
26.lvm
LVM is a logical volume management, which is a way to dynamically manage storage space. First, convert the disk or partition into a physical volume PV, then combine one or more PV into a volume group VG, and finally create a logical volume LV on the VG. LV can be formatted and mounted like a normal partition. If the LV space is insufficient, you can also expand it online.
27. New LV
#pvcreate/dev/vdb{1,2,3}
#pvs
#vgcreate vgtest/dev/vdb{1,2,3}
#vgs
#lvcreate-N lvtest-l1g vgtest
#lvs
#mkfs. ext4/dev/vgtest/lvtest
28.lv Disaster Recovery
Analog logical volume deleted by mistake
#umount/Home
#lvremove/dev/rhel/home
#vgcfgrestore-L Rhel View the log of the Rhel volume group to find out which log was before the LV was deleted
#vgcfgrestore-F/ETC/LVM/ARCHIVE/RHEL_00001-605793076.VG Rhel Recovery Volume Group based on the pre-deleted log
#lvchange-ay/dev/rhel/home to activate a logical volume
#mount-A Mount
29. Swap swap space Two ways: partition form and file form
Create a 512M file
[[email protected] ~]# dd If=/dev/zero of=/swapfile bs=1m count=512
[[email protected] ~]# mkswap/swapfile format into swap format
[[email protected] ~]# Swapon/swapfile temporarily loaded
[[email protected] ~]# swapon-s View swap
Linux Review 2