1, briefly describes the TCP three handshake four times the wave process and the client and server state in each process.
| 12345678910111213 |
#三次握手客户端向服务器端发送SYN包,客户端进入SYN_SEND状态服务器端收到客户端发送的包返回ACK+SYN包,服务器端进入SYN_RECV状态客户端收到服务器端返回的包再发回ACK包,客户端进入ESTABLISHED状态,服务器端收到包也进入ESTABLISHED状态客户端状态:SYN_SENDE STABLISHED服务器端状态:SYN_RCVE ESTABLISHED#四次挥手客户端发送FIN包询问服务器端是否能断开,客户端进入FIN_WAIT_1状态服务器端收到客户端发送的包并返回ACK包,服务器端进入CLOSE_WAIT状态服务器端准备好断开后,发送FIN包给客户端,服务器端进入LAST_ACK状态客户端收到服务器端发送的包后返回ACK包,客户端进入TIME_WAIT状态,服务器端收到包后进入CLOSED状态客户端状态:FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT服务器端状态:CLOSE_WAIT LAST_ACKC LOSED |
2, talk about the difference between the process and the thread
| 12 |
进程是并发执行的程序在执行过程中分配和管理资源的基本单位。线程是进程的一部分,线程的改变只代表了 CPU 执行过程的改变,而没有发生进程所拥有的资源变化。 |
3. Query file.txt the line ending with ABC
4. Delete blank lines in the File.txt file
5. Print the 10th line in the File.txt file
| 123 |
sed-n ‘10p‘ file.txt head -10 file.txt | tail-1 |
6. Backup and restore MySQL database test
Backup:
| 1 |
mysqldump -uroot -pPassword -hHostname test>/root/test.sql |
Recovery:
| 1 |
mysql -uroot -pPassword -hHostname </root/test.sql |
7. Use Netstat to count the number of connections to the various states of the current TCP connection.
| 1 |
netstat-nat| awk ‘{print $6}‘| sort | uniq-c |
8, Linux under How to convert GBK encoded format test_gbk.txt file into UTF-8 encoding format, the converted file name is Test_utf8.txt
| 1 |
iconv -f GBK -t UTF-8 test_gbk.txt -o test_utf8.txt |
9. Say what monitoring software you have used, and briefly describe its principles and application scenarios
| 12345 |
#zabbix agent方式监控:在被监控端安装agent程序,通过zabbix自己的协议主动或被动发送数据给server端或代理的proxy端,适用于服务器、工作站的监控,不适用于交换机、路由器、防火墙的监控。 SNMP方式监控:通过SNMP协议进行监控,需要开起并配置SNMP服务,适用于网络设备(交换机、路由器、防火墙)的监控,通信协议为UDP,所以不适用于服务器、工作站的监控。 |
10. Write commands to view Linux system performance, such as CPU, memory, traffic, IO, etc.
Top,free,iftop,iostat
11, said Nginx upstream support allocation strategy, and briefly describe its principle
| 12345 |
轮询:默认的方式,按时间顺序依次分配weight:根据服务器权重进行轮询分配ip_hash:按ip的hash值进行分配,可以解决session保持url_hash:按访问url的hash结果来分配请求,使每个url定向到同一个后端服务器,后端服务器为缓存时比较有效fair:按服务器响应时长进行分配 |
12, crontab timing: In November, every day in the morning 6 to 12 points, every 2 hours to perform a/usr/bin/httpd.sh how to achieve
| 1 |
0 6-12/2* 11 * /usr/bin/httpd.sh |
13, iptables prohibit IP 10.10.10.1 access to local 80 port
| 1 |
iptables -t filter -I INPUT -p tcp -s 10.10.10.1 --dport 80 -j DROP |
14. Find the content in file a but not in file B, and write the script after the command
| 12 |
#!/bin/bashdiff/root/a /root/b | grep "<" | awk‘$1=" "‘ |
15. Write a shell loop to create 100 users, user name format user_[0~99]
| 12345 |
#!/bin/bashfori in {1..100};do useradd user_$idoneecho"ok" |
Linux Basics Quiz