If you're going to interview one Linux Position of system operation and maintenance engineer , The following ten most common questions must be answered , Or your interview could be dangerous . These are basic questions , You need to understand , You can't just memorize .

  

1, How to view the version of the system kernel

 

There are two ways :

1) uname -a

uname This command is used to print system information , -a
All information of the system can be printed , Including kernel version , For example, my version number is 3.10.0-957.21.3.el7.X86_64.

 

2) cat /proc/version

 

Let's add the meaning of each number and letter :

*
3 Indicates the major version number , Change only when there is structural change ( The latest is 5)

*
10 Indicates minor version number , New features will change , General base represents beta , Even number for stable version .2020 year 3 month 30 day ,Linus Torvalds Released the latest Linux
The kernel version is 5.6

*
0 Indicates the number of revisions or patches to the minor version

*
957 Represents the number of compilations , Each compilation can optimize or modify a few programs

*
el7 Special information used to represent the version , There is greater randomness ;el On behalf of enterprise ,pp For beta ,fc representative Fedora core,rc Representative candidate

*
X86_64 express 64 position

 

 2, How to view the current IP address

 

There are two ways :

1)ifconfig -a

ifconfig Is the command used to configure the network interface ,-a Can display all current interfaces .

 

2)ip addr show

 

 

3, How to see how much space is left on the disk

 

It can be used here df -ah Command to view ,df Is a command used to view the disk space usage of the file system ,-a Show all file systems ,-h Display in a human readable way .

You can see my disk on it /dev/vda1 Yes 40 G, It's already used 1.7 G, also 36 G Free space for .

 

 

4, How to manage services in the system

 

You may be asked here , How to check whether a service is running , How to start , stop it , Or reload the configuration file . There are two answers here .

 

1) use service command

 

*
View service status

service [servicename] status

 

*
start-up / stop it / Restart service  

service [servicename] [start|stop|restart]

 

*
Reload service profile ( Do not restart service )

service [servicename] [reload]

 

For example, I want to check it sshd Is the service on

 

2) use systemctl command

Relatively new systems have been adopted systemd,systemctl yes systemd A tool for , Mainly responsible for control systemd System and service manager .

*
View service status

systemctl status [servicename]

 

*
start-up / stop it / Restart service  

systemctl [start|stop|restart] [servicename]

 

*
Reload service profile ( Do not restart service )

systemctl [reload] [servicename]

 

 

5, How to view the size of a directory

 

have access to du -sh [ catalog ] command ,du Use to calculate files / Directory size command ,-s Displays the size of the file or the entire directory ,-h Is in readable format .

For example, I checked my home directory above tmp Size of directory , There are 80 K

  

6, How to view the open port number in your system

 

1) use netstat command

netstat Command to display network status , Include network connections , Routing table , Interface statistics and other information . Common parameters are as follows :

-a (all) Show all options , Do not display by default LISTEN relevant .

-t (tcp) Show only tcp Related options .

-u (udp) Show only udp Related options .

-n Reject alias , All the numbers that can be displayed are converted into numbers .

-l List only those Listen ( monitor ) Service status of .

-p Display the name of the program that established the relevant link

-r Show routing information , Routing table

-e Show extended information , for example uid etc.

-s Statistics by protocol

-c Every other fixed time , Execute this netstat command .

 

Now I use it netstat -tulpn command , Port visible 22 Being monitored .

 

2) use ss command

Now there are many people using it ss command ,ss Commonly used to dump socket statistics . It can also display socket statistics of all types , include
PACKET,TCP,UDP,DCCP,RAW,Unix Domain etc . It can be used here ss -lntpd

  

7, How to view a process pair CPU Usage of

 

1) have access to top command

top The order is Linux Common performance analysis tools , It can display the resource usage of each process in the system in real time , be similar to Windows Task manager for .

 

2) use ps command

ps aux Show all users' processes , The most common method is ps aux, Then a pipe symbol is used to guide the grep To find a specific process . For example, check nginx Process can use  

ps aux | grep nginx

 

 

8,Linux How to mount in

 

The main test here is mount command , For mounting Linux Files outside the system .

Input only mount Command to view all files that have been mounted on the system .

If you want to mount a new file , For example /dev/hda1 Hang on /mnt under , It can be used  

mount /dev/hda1 /mnt

 

 9, How to view some commands you are not familiar with

 

What we need to test here is the use of man command . To a certain Linux 's command is not familiar , It can be used man < command >, The system will return a very detailed manual of the command , To help you use .

 

 

10, If used man I still can't find the answer

 

Baidu , Or in the Forum , Help God in the community ......

 

 

of course , It is not enough to grasp the above ten basic problems . We should pay attention to accumulation in our daily work and study ; Put your experience before the interview , Important knowledge points should be sorted out and fully prepared ; Adjust your mindset in the interview. , Answer questions calmly , Logic needs to be clear , Express clearly . Finally, I wish you all the best in your career .

 

 

 

Technology
©2019-2020 Toolsou All rights reserved,
TP6 Application examples of verifier and correct verification data ESP8266/ESP32 System : Optimize system startup time 2021 year 2 Chinese programming language ranking 2021 year 1 Monthly programmer salary statistics , average 14915 element CSS architecture design It's not depravity that's terrible , It's about knowing you're falling Gude Haowen serial - You deserve to be an engineer ( Preface ) Software testing BUG describe C Course design of language programming of 《 Student achievement management system 》vue In the project axios Global encapsulation of