A, linux command review
1.ls: lists the files in the current directory
-h:
-l:
-d:
-a:
2. man: Command Help Manual
3. cd: Change directory
-:
~:
..:
cd:
4. pwd: Displays the current working directory
5. cp: copy files or directories
-a: the equivalent of -rp
-r:
-p: remain unchanged property
6. touch
7.mkdir:
-p:
8. echo
-e:
-n:
9. mv
10. rm
-f:
-r:
-rf
11. rmdir:
12. cat
-n
13. more
14. less
15. head
16. tail
-f:
17. poweroff
18. reboot
19. clear
ctrl+l
20. alias
21. unalias
22. uname:
-a:
-r:
23. su:
-:
24. hostname
25. hostnamectl set-hostname
26. history
!
27. which
28. wc
-l:
-w:
-c:
29. w
30. who
31. whoami
32. ping
-c:
-w:
-i:
33. kill
kill -15:
kill -9:
34. ps
to:
-If:
35. ss
-t:
-n:
-l:
-a:
36. lsof
37. yum
yum clean all:
yum repolist:
yum install s1... -y
yum list/yum list all
@: Installed
yum list installed
yum list available
38. rpm
rpm -ivh
rpm -e
rpm -q
rpm -qa
rpm -ql
rpm -qf
39. df
-h
40. the
-h:
-s:
41. free
-h:
-m:
42. top
43. uptime
44. find
-name:
-type: f/d/l
-mtime:
-ctime:
-atime:
-perm:
-user:
-group:
-nouser:
-nogroup:
-size:
-exec rm -rf {} \;
| xargs rm -rf
45. grep:
-E:
-n:
-c:
-O:
-A:
-B:
-C:
-v:
-i:
46. But,
-n:
-r:
-e:
-i:
47. awk:
-F: -F " "
48. useradd
-r:
-s:
-u:
-g:
-G:
49. userdel
-r
50. usermod
-r:
-s:
-u:
-g:
-G:
-l:
51. takes
czvf
xzvf
52. date
-s:
%F:
%T:
53. unzip
54. mount
-t:
55. umount
56. crontab
-l:
-e:
-r:
-u:
57. at
atq:
atrm
at -l
58. mdadm:
-C:
-v:
-n:
-l:
-x:
59. fdisk:
-l:
60. mkfs.xfs
61. pvcreate:
62. vgcreate
63. lvcreate
-n:
-L:
-l:
64. lvextend
65. xfs_growfs
66. chmod
-R:
67. chown
-R:
68. setfacl:
-m:
-b:
69. getfacl
70. sudo
visudo
71. ssh
-p:
72. scp:
-P:
-r:
73. systemctl
start:
restart:
stop:
reload:
enable:
disable:
status
74. vim
-O:
-O:
75. cut:
-d:
-f:
-c:
76. sort:
-n:
-r:
-t:
-k:
77. uniq:
-c:
78. seq:
79. tr
-d:
80. groupadd:
81. passwd
echo "password" | passwd --stdin "username"
82. ip
ip a: ip address show
ip r: ip route show
ip a a: ip address add
83. id
84. rz
85. sz
86. swapon
87. swapoff
-a:
88. wget
-P:
89. curl
90. partprobe
91. nslookup
view domain information
92. source
93. bash
94. showmount
-e:
95. ntpdate
96. ntpstat
97. cobbler
98. httpd -t
99. nginx -t
100. tree
101. pstree
102. ssh-keygen
103. ssh-copy-id
104. telnet
105. pdbedit
-a:
-u:
106. make
107. make install
108. setenforce 0
109. getenforce
110. exit
111. dd if=/edv/zero of=test bs=100M count=2
Two, linux service review
1. samba
yum install samba -y
vim /etc/samba/smb.conf
[Ren]
path = /ren
read only = no
public = yes
sed -i '$a [ren]\npath = /ren\nread only = no\npublic = yes' /etc/samba/smb.conf
systemctl restart smb
useradd ken
pdbedit -a -u ken
2. ftp(20/21)
vsftpd:
useradd ren01
/etc/vsftpd/vsftpd.conf
anonymous_enable=NO
3. ntp(123)
server 127.127.1.0
restrict 127.0.0.1
restrict 192.168.11.5 mask 255.255.255.0
3.5. chrony(323)
allow 192.168.10.0/24
4. NFS (2049)
systemctl restart rpcbind nfs
/etc/exports
/ren 192.168.11.5/32(rw)
5. DHCP
/usr/share/doc/dhcp-*/dhcpd.conf.example
/etc/dhcp/dhcpd.conf
subnet 192.168.11.0 netmask 255.255.255.0 {
range 192.168.11.10 192.168.11.200;
}
6. DNS
A: forward resolution
PTR: reverse analysis
7. apache
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*.conf
Listen 81
<VirtualHost *:81>
ServerName a.com
DocumentRoot /work/html1
<Directory "/work/html1">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
directoryindex
/etc/hosts
LAMP:
yum install httpd php php-mysql mariadb-server -y
8. tomcat
8005:
8009:
8080:
9. nginx
/etc/nginx/nginx.conf
/etc/nginx/conf.d/*.conf
server {
list 80;
server_name a.com;
location / {
root /work;
}
}
Reverse Proxy
proxy_pass
Load Balancing
upstream
LNMP
yum install nginx php php-fpm php-mysql mariadb-server -y
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
location ~ \.php$ {
fastcgi_pass 192.168.64.5:9000;
include fastcgi.conf;
}
10. cobbler
yum install cobbler dhcp httpd syslinux xinetd tftp-server pykickstart -y
vim /etc/dhcp/dhcpd.conf
systemctl restart dhcpd
systemctl enable dhcpd
vim /etc/xinetd.d/tftp
disable = no
systemctl restart xinetd
systemctl enable xinetd
systemctl restart httpd
systemctl restart cobblerd
cobbler check
vim /etc/cobbler/settings
sed -i '384s/127.0.0.1/$IP/g' /etc/cobbler/settings
sed -i '272s/127.0.0.1/$IP/g' /etc/cobbler/settings
systemctl restart rsyncd
101 default_password_crypted:" "
systemctl restart cobblerd
cobber check
cobbler sync
mount /dev/cdrom /mnt
cobbler import --path=/mnt --name="centos7.5"
kickstart:
url --url=http://
cobbler profile add --kickstart=/var/lib/cobbler/kickstart/ks.cfg
--distro=centos7.5_x86-64 --name="centos7.5_ken"
11. pxe
yum -y install dhcp tftp-server xinetd syslinux httpd
12. SVN
yum -y install svn
vim /etc/sysconfig/svnserve
/ Var / svn / clean
authz passwd svnserve.conf
svn checkout
svn update
Three, shell programming
1. IP Regular:... "^ ([0-9] \ | [1-9] [0-9] \ | 1 [0-9] [0-9] \ | 2 [0-4] [ 0-9] \ |.. 25 [0-5] \) {3} ([1-9] | [1-9] [0-9] | 1 [0-9] [0-9] | 2 [0-4] [0-9] | 25 [0-4]) $ "
Password (at least eight, the case of letters, numbers): "egrep [az] | egrep [AZ] | grep [0-9] | grep ^ {8,} $."
2. if conditions
then
elif condition; then
else
be
3. for variables in scope
do
done
4. while :
do
done
break exit continue
5.case