I have answered a linux interview question from a company.

Source: Internet
Author: User
For a company's linux interview question, I have answered the question-Linux general technology-Linux technology and application information. The following is a detailed description. Interview Questions
1. Set the IP address, gateway, and DNS of the linux server in Beijing
The IP address is 192.168.0.120.
The gateway is 192.168.0.1.
DNS is 202.101.112.55 202.101.98.55
2. How to Find Files whose owner is CSMAIL
3. How to find files containing CSMAIL
4. Run VI to create a file with several lines of numbers. How can I find a number * after the number at the end of each line?
5. How can I merge every two rows in a text into one row to connect each even row to the end of an odd row?

6. Cut out the IP address output by IFCONFIG
7. How do you know the program is running port 25 and KILL it.
8. How to set the time on the text interface.
9. How to know the number of lines in a file
10. What do you do if you want to remotely manage a SERVER without enabling SSH or TELNET? How to remotely manage the SERVER

A:
1. (1) edit/etc/network/interfaces // ip address and gateway
(2) Configure // DNS in etc/resolve. conf
Address 192.168.0.120
Netmask 255.255.255.0
Network 192.168.0.1

2.
A: find/-user CSMAIL // The owner is the user's CSMAIL file.
3.
A: find/-type f-exec grep-l CSMAIL {}\;

4.
: % S/$/*/g
Or
% S/string/replace/g: replace the full-text string with the replace string,
$: Move to the end of the row where the cursor is located.
G indicates that all replace does not need to be confirmed
5
A: In the command mode of VI, follow the sequence below:

Explanation:
Gg is to the file header
Q indicates record macro start
Q indicates that the macro is recorded in the q register.
J indicates merging two rows
J indicates moving down a row
Q: End record macro
1000000 indicates to run the next command 1000000 times until an error occurs.
@ Indicates that the macro is run.
Q indicates the macro in the q register.

6.
A:
Ifconfig | grep 'inet addr '| awk-F:' {print $2} '| awk' {print $1 }'
Use ifconfig output to switch IP addresses
7.
A: After netstat-antp finds the PID, ps-anx kill the PID.
Or lsof-I: 25 get the pid and kill it.
8.
Answer: date-s system time
9.
Answer: wc-l file

10. What do you do if you want to remotely manage a SERVER without enabling SSH or TELNET? How to remotely manage the SERVER
A: The server uses the hard disk to install ssh and telnet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.