The latest compilation of Linux network and troubleshooting commands in 2023, it is strongly recommended to collect!

Proficiency in the application of various display commands and the meaning of displayed information are one of the necessary skills for maintenance engineers.

Overview of the display command

The display command is an important tool for network maintenance and troubleshooting. It can be used to understand:

  • The current condition of the device.
  • Detect neighboring devices.
  • Overall monitoring network.
  • Locate network faults.

The display command of the device can be run in all views, which is convenient for users to view various information at any time.

For example, some options of the display command of the device are as follows.

<AC6605> display ?
  aaa                       AAA                                                  
  access-user               User access                                          
  accounting-scheme         Accounting scheme                                    
  acl                       <Group> acl command group 
  actual                    Current actual                                       
  alarm                     Alarm                                                
  antenna                   Current antenna that outputting radio                
  anti-attack               Specify anti-attack configurations                   
  ap                        <Group> ap command group 
 ---- More ----      
  • The above information lists some first-level keywords that can be used by the display command. Most keywords can be followed by more keywords, so that users can learn information at different levels.
  • Different devices or different versions of the same device support different features, and the features mentioned in the above information may not be available on some devices.

This section only introduces some of the most commonly used display commands.

Regular expressions in the display command

regular expression

A regular expression describes a pattern for string matching, consisting of ordinary characters (such as characters a to z) and special characters (or "metacharacters"). A regular expression acts as a template to match a pattern of characters against the string being searched for.

Regular expressions generally have the following functions:

  • Checks for a substring in a string that matches a certain rule, and can get that substring.
  • Replace strings according to matching rules.

Regular expressions consist of ordinary and special characters.

normal characters

Ordinary characters are matched against the ordinary characters themselves. Includes all uppercase and lowercase letters, numbers, punctuation marks, and some special symbols. For example: a matches a in abc, 10 matches 10 in 10.113.25.155, @ matches @ in [email protected].

Special characters

Special characters and ordinary characters match complex or special string combinations. Table 2-2 is a description of the use of special characters and their grammatical meanings.

Table 2-2 Description of special characters and their grammatical meaning

Special characters Function example
\ escape character. Mark the next character (special or normal) as a normal character. *match*
^ Match the position of the beginning of the line. ^10 matches 10.10.10.1, not 172.20.10.1
$ Matches the position of the end of the line. 1$ matches 10.10.10.1, does not match 10.10.10.2
* Matches the preceding subregex zero or more times. 10* can match 1, 10, 100, 1000, ... (10) * can match empty, 10, 1010, 101010, ...
+ Matches the preceding subregex one or more times. 10+ can match 10, 100, 1000, ... (10) + can match 10, 1010, 101010, ...
? Matches the preceding subregex zero or one time. Explanation: Currently, use regular expression input on Huawei's data communication equipment? , the system displays the command line help function. Does Huawei's data communication equipment support regular expression input? Special characters. 10? can match 1 or 10(10)? can match empty or 10
. Match any single character. 0.0 can match 0x0, 020, .... oo. It can match book, look, tool, ...
() A regular expression enclosed in parentheses acts as a subregular expression, matches the subexpression and obtains the match. Parentheses can also be empty. 100(200)+ can match 100200, 100200200, ...
x|y Match x or y. 100|200 matches 100 or 2001(2|3)4 matches 124 or 134, but does not match 1234, 14, 1224, 1334
[xyz] Matches any one character contained in the regular expression. [123] matches 2 of 255
[^xyz] Matches characters not included in the regular expression. [^123] matches any character except 123
[a-z] Matches any character within the range specified by the regular expression. [0-9] matches all digits between 0 and 9
[^a-z] Matches any character outside the range specified by the regular expression. [^0-9] matches all non-numeric characters
_ Matches a comma (,), opening brace ({), closing brace (}), opening parenthesis, closing parenthesis. Matches the beginning of the input string. Matches the end of the input string. Matches a space. _2008_ can match spaces 2008 spaces,,,2008,, {2008}, (2008), {2008), (2008}_2008 can match spaces 2008,,2008, (2008, {20082008_ can match 2008 spaces, 2008,, 2008), 2008}

Unless otherwise specified, the characters involved in the above table refer to printable characters.

  • Degradation of special characters

Some special characters will degenerate and become ordinary characters if they are in special positions in the following regular expressions.

  • If a special character is after the escape symbol '\', it will be escaped and become a match for the character itself.
  • Special characters "*", "+", "?" are in the first character position of the regular expression. For example: +45 matches +45, and abc( def) matches abc def.
  • The special character "^", not in the first character position of the regular expression. For example: abc^ matches abc^.
  • The special character " 2 matches 12$2.
  • A right bracket ")" or "]" does not have a corresponding left bracket "(" or "[". Example: abc) matches abc), 0-9] matches 0-9].

Unless otherwise specified, the above regular expressions include sub-regular expressions enclosed in brackets "()".

  • Combination of normal characters and special characters

    In practical applications, it is often not a common character plus a special character used together, but a combination of multiple common characters and special characters to match a character string with certain characteristics.

Specify the filter method in the command

  • The device uses regular expressions to implement the filtering function of pipe characters. Not all display commands support the pipe character. When displaying a lot of information, the display command supports the pipe character; when the displayed information is small, the display command does not support the pipe character.
  • When querying by filter conditions, the first line of information displayed starts with the entire message containing the string, not with the filter string.

The system supports the use of | count to display the number of rows of the output result after using the filter condition. Can be used in conjunction with filtering.

In commands that support regular expressions, there are three filtering methods to choose from:

1、| begin regular-expression

Output all lines beginning with a line matching the specified regular expression.

That is to filter out all strings to be output until the specified string appears (this string is case-sensitive), and all subsequent strings will be displayed on the interface.

2、| exclude regular-expression

Output all lines that do not match the specified regular expression.

That is, if the string to be output does not contain the specified string (this string is case-sensitive), it will be displayed on the interface; otherwise, the filter will not be displayed.

3、| include regular-expression

Only output all lines matching the specified regular expression.

That is, if the string to be output contains the specified string (this string is case-sensitive), it will be displayed on the interface; otherwise, the filter will not be displayed.

regular-expression is in the form of a character string with a length ranging from 1 to 255 characters. If the regular-expression contains a special character, and the character is only used as the character itself, the escape character "\" needs to be added before the special character.

The following example illustrates the usage of specifying the filtering method in the command.

Example 1: Execute the command display interface brief to display all lines that do not match the regular expression "GigabitEthernet|Wlan-Dbss|Tunnel", "GigabitEthernet|Wlan-Dbss|Tunnel" means matching Tunnel".

<AC6605> display interface brief | exclude GigabitEthernet|Wlan-Dbss|Tunnel
PHY: Physical                                                                    
*down: administratively down                                                     
(l): loopback                                                                    
(s): spoofing                                                                    
(b): BFD down                                                                    
(e): ETHOAM down                                                                 
(d): Dampening Suppressed                                                        
InUti/OutUti: input utility/output utility                                       
Interface                   PHY   Protocol InUti OutUti   inErrors  outErrors    
Eth-Trunk1                  down  down        0%     0%          0          0    
LoopBack0                   up    up(s)       0%     0%          0          0    
MEth0/0/1                   up    up          0%     0%          0          0    
NULL0                       up    up(s)       0%     0%          0          0    
Vlanif1                     up    down        --     --          0          0    
Vlanif2                     down  down        --     --          0          0    
Vlanif3                     down  down        --     --          0          0    
Vlanif4                     down  down        --     --          0          0    
Vlanif10                    up    up          --     --          0          0    
Vlanif100                   down  down        --     --          0          0    
Vlanif101                   down  down        --     --          0          0    
Vlanif102                   down  down        --     --          0          0    
Vlanif400                   up    up          --     --          0          0    
Wlan-Ess0                   down  down        0%     0%          0          0    
Wlan-Ess1                   down  down        0%     0%          0          0    
Wlan-Ess10                  up    up          0%     0%          0          0    
Wlan-Ess100                 down  down        0%     0%          0          0   

Example 2: Execute the command display current-configuration to display only all lines matching the regular expression "vlan".

<AC6605> display current-configuration | include vlan
vlan batch 10 400
 port trunk allow-pass vlan 10
 port trunk pvid vlan 10

The displayed information in the above example is for illustration only.

Commonly used display commands

The device provides multiple display commands to view the status information of hardware components, interfaces, and software. Usually, these status information can provide users with troubleshooting ideas.

Commonly used commands for collecting fault information are as follows:

1. Basic information
display diagnostic-information

This command is mainly used to collect the basic information of the system. It collects the output information of many commonly used displaycommands, including display version, display current-configurationetc. This information must be provided when any online problem occurs. Please note that this command takes a long time to execute. If you use the display mode directly on the terminal, you can stop it by pressing Ctrl+C .

2. Device information
display device

This command is usually used to view the status of a board when it is found that the board is not working properly. If the Status is Abnormal, the status is abnormal.

3. Interface information
display interface

This command is usually used to view various information of the interface, and is often used for interface faults on the device and to view packet loss statistics.

4. Version information
display version

The version used by the faulty device is important information for locating. display versionThe command can obtain information such as device software, BootROM, main control board, and fan module, and at the same time, can obtain information about the size of various memories.

Note: ACU2 does not have a fan.

5. Patch information
display patch-information

The version used by the faulty device is important information for locating. display patch-informationThe command can obtain the patch package information of the current system, including: patch package version number, patch package name and other basic information.

6. Electronic label information
display elabel

The electronic label is used to identify the hardware information of the device. You can use this command to check the electronic label information on the board.

7. Device status information
display health

This command is used to view device temperature information, power information, fan information, power information, CPU and memory usage information, and storage media usage information.

Note: ACU2 does not have a fan.

8. The current configuration information of the system
display current-configuration

This command is used to display all configuration information on the current device. Regular expressions can be used to filter configuration information in order to find the currently required information.

9. Configuration information saved by the system
display saved-configuration

If the device is powered on successfully and does not work normally after entering the system, you can execute display saved-configurationthe command to view the startup configuration of the device, that is, view startup saved-configurationthe configuration file specified by the command.

display saved-configuration lastThe command is used to view the last saved system configuration information.

display saved-configuration timeThe command is used to view the time of the last saved system configuration.

10. Time information
display clock

Displays the system's current date and clock.

11. User log information
display logfile buffer

Execute this command in the diagnostic view to view user log information in the log file buffer.

12. Diagnostic log information
display diag-logfile buffer

Execute this command in the diagnostic view to view diagnostic log information in the log file buffer.

13. Alarm information
display trapbuffer

This command is used to view the information recorded in the trap buffer of the information center.

14. Memory usage information
display memory-usage

Execute display memory-usagethe command to view the memory usage of the device.

15. CPU usage
display cpu-usage

Execute display cpu-usagethe command to view the CPU usage of the device.

16. AP running information

V200R005 and earlier versions:

display ap-run-info

V200R006 and later versions:

display ap run-info

Run this command to view AP running information.

Note: Precondition: AP status is normal.

17. AP status
display ap all

Execute this command to view the status of the AP.

18. Access user information
display access-user

display station

Execute this command to view information about access users.

19. AP and user online service diagnostic information for the whole process
display trace information

Before executing this command, you need to execute the following commands to enable the business diagnosis function and configure the diagnosis object:

[AC6605] trace enable
[AC6605] trace object mac-address e468-a352-1160   //e468-a352-1160为AP或STA的MAC地址

Guess you like

Origin blog.csdn.net/weixin_43025343/article/details/132360507