Use grep to find the lines that start with root and end with bash in the /etc/passwd file, and display the line number.
Use find to find /usr/ files modified in the last 7 days and copy them to /dir
. Save the line content as testx.txt
grep -n'^root.*bash' /etc/passwd
find /usr/ -type f +mtime +7 -name ‘*’ |xargs -i cp{}/dir/;
sed -n ‘1,3p’ /etc/passwd >>test.txt
-
Nginx reverse proxy configuration, such url www.jkkcss.cn/refuse, access is forbidden, return 403
location www.jkkcss.cn/refse { return 403: } -
How to use iptables to forward the request of the local port 80 to port 8081, the current host IP is 192.168.10.1, and the local network card eth0:
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 8081 -j DNAT --to 192.168.10.1:80 -
How to check the current status of the Linux system, CPU memory usage and load
top
free -h -
How does nginx redefine or add the request
headers sent to the backend server. The headers-more-nginx-module module is used to add, modify, or clear request/response headers.
more_set_headers is used to add, modify, and clear response headers.
more_clear_headers is used to clear response headers.
more_set_input_headers is used to add, modify, and clear request headers
more_clear_input_headers is used to clear request headers -
Write a shell script to transfer files larger than 10K in the current directory to the /tmp directory
#!/bin/bash
for Filename in $(ls -l |awk'$5> 10240 {print $9}')
do
mv $Filename /tmp
done -
Write down the service architecture of the portal website you know, and what ways can be used to achieve high availability and load balancing?
lvs+keepalived
nginx+keepalived
nginx +tomcat nginx is responsible for forwarding and processing static resources tomcat is responsible for dynamic -
Nginx log filtering access IP ranking and statistics between 10 o'clock and 12 o'clock
cat nginx.log| grep "16/Jun/2020" |sed -n'/10:00:00/,/12:00:00/p' |awk'{print $1}'|sort|uniq -c| sort nr ' -
How to execute usr/bin/httpd.sh every 2 hours from 6 am to 12 am in November
- 6-12/2 * 11 * /usr/bin/httpd.sh
- Have you ever understood and used distributed file storage?
FastDFS
solves the problem of large data storage and load balancing, and is especially suitable for online services with small and medium files, such as online photo albums, video websites, and so on. Network disk community, storage of advertisements and application downloads.
Supplement:
Stand-alone era: Store file resources in a static directory.
Advantages: Convenience, the project directly references the directory, no complicated technology is required.
Disadvantages: If used as a front-end website, the code and files are coupled together, the more files are stored, the more messy it will be. If the traffic is large, static file access will occupy a certain amount of resources and affect the normal operation of the business
The era of independent file server:
Disadvantages: Click performance bottlenecks, disaster tolerance, and poor vertical expansion capabilities.
For example, an independent picture server, the last time the project file was uploaded to a certain directory of the picture server through ssh or ftp, when the directory is accessed through nginx, the URL address of an independent domain name is returned.
Distributed file system:
Advantages: Scheduled backup, if one is down, quickly switch to another. Strong scalability, can ensure the availability of the file system, and can also ensure the integrity and uniqueness of the data
Disadvantages: The system is more complex and requires more servers
Common distributed file systems include: GlusterFS, GoogleFS, TFS, OSS
-
Use netstat and awk commands to count the number of network connections:
netstat -an | awk'/^tcp/ {++y[$NF]} END {for(w in y) print w, y[w]}' -
Under linux, suppose the path of nginx log is opt/logs/access.logs, the log cannot be divided automatically, please write a simple script to make the log automatically divided every day
cp access.logs /tmp/"%Y%m %d".access.logs
echo> access.log -
Write down several modes of raid and their characteristics
-
Write a script to find files ending with png 15 days ago and delete
#!/bin/bash
find /picture/ .png -type f -mtime +15 -exec rm {};
fiind /mnt -type f -mtime +15 -name *.png -exec rm {}; -
What kind of tools have been used for server monitoring and their characteristics
-
As an operation and maintenance engineer, what do you know about the position and what should you do in your daily work?
Responsible for the stability of the service, ensuring that the service can provide services to users without interruption 7*24H, ensuring user data security and improving user experience
Optimize servers and architecture through technical means to reduce company costs
. What should you do at work? -
Monitoring, alarm, online deployment
-
Script automation, tool automation
-
Troubleshooting
Need to see more interview questions to share. I recorded a lot of interview questions in 51cto Academy and I shared them in the form of video. I really hope to help you find a job and reduce the pressure. If you are interested in video interview questions, you can search for Zhang Kai at 51cto to find me or open this link to find it: https://edu.51cto.com/sd/a021e