Home > Operation and Maintenance > Linux Operation and Maintenance > Share an example tutorial on interviewing

Share an example tutorial on interviewing

PHP中文网
Release: 2017-06-21 11:16:49
Original
1954 people have browsed it

Question:

  1. Which parameter is used for awk, grep, sed to ignore case?

  2. 403 status code What does it mean?

  3. How does vim jump to the last line and the first line?

  4. What is the difference between static pages and dynamic pages?

  5. There are 100 directories in a Linux directory. How to find the largest directory?

  6. The browser QQ can be accessed, but the web page cannot be accessed. How to troubleshoot? ?

  7. What is the port number of the ftp protocol?

  8. TCP three-way handshake, write out ack and seq?

Just remember the 8 questions above.

The first question is very simple, it must be the parameter -i

The second question is also very simple, 404 means requesting resources Does not exist. 403 means that the server received the request but refused to provide the service. 503 means that the server cannot currently handle the client's request and may return to normal after a period of time.

The third question is also very simple. Toreturn to the first line, press lowercase "gg", toReturn to the last line, press "Shift + g"

The fourth question is the difference between dynamic web pages and static web pages. I was very happy when I heard this question, and answered, "Static web pages use HTML and CSS layout, and the web pages are static; dynamic web pages add js, jquery, and ajax, and can interact with the background and can also have carousel images." Effect". This kind of answer must be a big mistake!! Old iron, this is heartbreaking!!

You can read this great master’s blog: The difference between static pages, dynamic pages and pseudo-static pages

Summary:

Static page: The access speed is fast, there is no need to extract data from the database, and it will not put pressure on the server. However, static pages are stored in HTML, which takes up a lot of server space, and a new HTML page is generated every time content is added. Maintenance is troublesome if you are not a professional.

Dynamic pages: use less space on the server. The data is retrieved from the database. If you need to modify some data on the page, directly change the database, then all dynamic web pages will be automatically updated. However, user access is slower.

Why is it slow to access dynamic pages? This problem starts with the access mechanism of dynamic pages. In fact, there is a template engine on our server (for template rendering). When a user visits, the template engine will translate the dynamic page into a static page, so that everyone can view the source code in the browser (the source code after rendering by the template engine). In addition to the slow access speed, the data of dynamic pages is called from the database. If a large number of people visit, the pressure on the database will be very high. Most of today's dynamic programs use caching technology. But generally speaking, dynamic pages put greater pressure on the server. Generally speaking, dynamic pages put greater pressure on the server. At the same time, websites with dynamic pages generally have higher requirements for servers. The more people visiting at the same time, the greater the pressure on the server.

Of course, it can also be said: the static pages accessed by different users are the same; but the dynamic pages accessed can be different.

The fifth question

在你想查的目录下 执行这个 du -sh * | sort -h 会把占用空间最大的文件列在最后 放在开头的话 du -sh * | sort -rh
Copy after login

The sixth question

Network settings and DNS server problems
There are many possibilities for this problem. For specific reference: Why does the computer How to solve the problem of being able to access QQ but unable to open the website

Now I will start with DNS and talk about possible problems and how to solve them. If you can access QQ, it means that the PC can access the external network, but if you cannot open the website, there may be a DNS problem. You can ping www.baidu.com in cmd and then ping Baidu's IP address. If the former fails to ping but the latter can ping successfully. It means there is a problem with DNS. The following are related solutions found on the Internet:

  1. Some netizens have set up a proxy server in their browser (Control Panel - -Internet Options-Connection-LAN Settings-Use proxy server for LAN), setting proxy server will not affect QQ networking, because QQ uses port 4000, while accessing the Internet uses port 80 or 8080 . This is why many people don't understand why QQ can be accessed but the web page cannot be opened. The proxy server is generally not very stable. Sometimes it can be accessed, and sometimes it cannot be accessed . If there is such a setting, please cancel the proxy.

  2. When IE cannot browse the web page, you can first tryto access it using the IP address. If it can be accessed, it should be a DNS problem , The DNS problem may be an error in obtaining DNS when connecting to the Internetor a problem with the DNS server itself. In this case, you can manually specify the DNS service (the address can be your The DNS server address provided by the local ISP can also be used normally elsewhere). Proceed in the properties of the network (click "Start → Control Panel", double-click to open "Network Connections", right-click "Local Area Connection", select "Properties", select "Internet Protocol (TCP/IP)", click "Properties", check if it is the correct network in "Use the following DNS server address").

  3. #Different ISPs have different DNS addresses. Sometimes it is a problem with the router or network card, which cannot connect to the ISP's DNS service. In this case, you can turn the router off for a while and then turn it on again, or reset the router. If the problem still cannot be solved, you can try updating the network card driver and changing the network card.

  4. # Another possibility is that

    there is a problem with the local DNS cache. In order to improve website access speed, the system will automatically store the website that has been visited and obtained the IP address into the local DNS cache. Once the website is accessed again, it will no longer go through the DNS server but directly from the local DNS cache. Get the IP address of the website to access. Therefore, if there is a problem with the local DNS cache, the website will be inaccessible. You can execute ipconfig /flushdns under cmd to rebuild the local DNS cache.

The seventh question asks: What is the port number of the ftp protocol?

Unfortunately, I couldn’t remember the port number of the ftp protocol at the time, so I answered that it was 22 for ssh and 23 for telnet. Then the interviewer said 20, 21; also said active and passive. I was really confused...

After I came back, I checked the information on the Internet, and I feel that this blog is the best: The difference between FTP active mode and passive mode

Basic knowledge:

FTP only connects through TCP, there is no UDP component for FTP. F

TP is different from other services in that it uses two ports

,a data port and a command port (or called a control port). Usually 21 port is the command port and 20 port is the data port. When the concept of active/passive mode is mixed in, the data port may not be 20. Active mode FTP:

Look at the picture first:

In active mode, the FTP client connects to the command port of the FTP server - port 21 from any non-special port (N > 1023). Then the client listens on port N+1 (N+1 >= 1024) and sends commands to the FTP server through port N+1 (N+1 >= 1024). The server will in turn connect to the data port specified locally by the user, such as port 20.

Based on the server-side firewall, to support active mode FTP you need to open the following ports used in interaction:

  • FTP server command (21) port accepts any port of the client (client initial connection)

  • FTP server command (21) port to client port (>1023) (server responds to client terminal command)

  • FTP server data (20) port to client port (>1023) (server initialization data connection to client data port)

  • FTP server data (20) port accepts client port (>1023) (client sends ACK packet to server's data port)

in 1st In this step, the client's command port establishes a connection with the FTP server's command port and sends the command "PORT 1027". Then in step 2, the FTP server returns an "ACK" to the client's command port. In step 3, the FTP server initiates a connection from its own data port (20) to the data port (1027) previously specified by the client, and finally the client returns an "ACK" to the server in step 4.

The main problem with active FTP actually lies on the client. The FTP client does not actually establish a connection to the server's data port. It simply tells the server the port number it is listening on, and the server then connects back to the specified port of the client. For the client's firewall, this is establishing a connection from the external system to the internal client, which is normally blocked.

Passive mode FTP

In order to solve For the problem of server-initiated connections to clients, a different way of connecting to FTP was developed. This is called passive mode, or PASV, and is enabled when the client notifies the server that it is in passive mode.

In passive mode FTP, both the command connection and the data connection are handled by the client, which can solve the problem of the inbound connection from the server to the client's data port being filtered by the firewall. When opening an FTP connection, the client opens two arbitrary non-privileged local ports (N >=1024 and N+1). The first port is connected to port 21 of the server, but unlike active FTP, the client will not submit a PORT command and allow the server to connect to its data port back and forth, but submits a PASV command. The result of this is that the server will open an arbitrary non-privileged port (P >=1024) and send the PORT P command to the client. The client then initiates a connection from the local port N+1 to the server's port P to transmit data.

For the server-side firewall, the following communication must be allowed to support passive FTP:

  1. FTP server command ( 21) Port accepts any client port (client initial connection)

  2. FTP server command (21) port to client port (>1023) (server responds to client command)

  3. FTP server data port (>1023) accepts client port (>1023) (client initializes data connection to any port specified by the server)

  4. FTP server data port (>1023) to client port (>1023) (the server sends ACK response and data to the client’s data port)

In step 1, the client's command port establishes a connection with the server's command port and sends the command "PASV". Then in step 2, the server returns the command "PORT 2024", telling the client (server) which port to use to listen for data connections. In step 3, the client initializes a data connection from its own data port to the data port specified by the server. Finally, the server returns an "ACK" response to the client's data port in step 4.

Passive FTP solves many problems on the client side, but it also brings more problems to the server side. The biggest problem is the need to allow connections from any remote terminal to the server's high port. Fortunately, many FTP daemons, including the popular WU-FTPD, allow the administrator to specify the port range used by the FTP server. See Appendix 1 for details.

The second problem is that some clients support passive mode and some do not support passive mode. We must consider how to support these clients and provide solutions for them. For example, the FTP command line tool provided by Solaris does not support passive mode and requires a third-party FTP client, such as ncftp.

With the wide popularity of WWW, many people are accustomed to using web browsers as FTP clients. Most browsers only support passive mode when accessing URLs like ftp://. Whether this is a good or bad thing depends on the server and firewall configuration.

The following is a brief summary of the advantages and disadvantages of active and passive FTP:

 Active FTP is beneficial to the management of the FTP server , but it is not good for client management. Because the FTP server attempts to establish a connection with the client's high random port, and this port is likely to be blocked by the client's firewall. Passive FTP is good for FTP client management, but bad for server-side management. Because the client needs to establish two connections with the server, one of which is connected to a high random port, and this port is likely to be blocked by the server's firewall.

Fortunately, there is a compromise. Since FTP server administrators need their servers to have the maximum number of client connections, passive FTP must be supported. We can reduce the exposure of the server's high ports by specifying a limited port range for the FTP server. Thus, any port not in this range will be blocked by the server's firewall. While this doesn't eliminate all dangers to the server, it greatly reduces the dangers. .

Soft connections and hard connections were also asked. For example, when asking about the difference, I made an analogy at the time: soft connections are like shortcut keys under Windows. Deleting a soft link does not affect the pointed file, but if the original file pointed to is deleted, the related soft link is called a dead link. Just like if a Windows file is deleted, its shortcut method is not abolished.

A hard link file is equivalent to another entry in the file. Files are stored in blocks on the disk, and hard links are made by pointing to the block blocks through index nodes. The file will have at least one hard link, which is itself. If all hard links to a file are gone, it means the file has been deleted.

so, I was asked a question at that time, a directory takes up a lot of space. How to delete it? If you want to delete it, you must back it up first, but the directory is too large, and the backup also takes up a lot of disk space. So backup is not wise. The correct approach is to first create an additional hard link to this directory and then delete the directory. If the system becomes normal after a period of time, the deleted content will not have an impact on some businesses. Only then can the previously created hard link be deleted, and the directory is actually deleted.

This time I went to interview an operation and maintenance intern. I have been learning Linux for more than a month, except for two weeks to work on projects. A lot of Linux knowledge is not often used, so when asked, I don’t know how to answer, which is embarrassing~_~

There are many things that you don’t know you are good at unless you try them, hahaha. Finally, here’s a joke:

The above is the detailed content of Share an example tutorial on interviewing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template