First of all, the more commonly used command is ip a s. Execute ip a s in the command line to output all network card information, including virtual network cards
If there are many network cards, you have to judge based on experience. Which one is the network card IP you want? I have four network cards here, usually en0, and here I am em4. Check the inet inside and it will be the ip address
Recommended free learning video tutorials: linux video tutorial
In fact, the ip address of each network card is the ip of its own machine , only IPs in the same network segment can access each other. The ip a s command is an abbreviation, the full name is ip addr show, using this is equivalent to ip a s
If the previous command After executing, it prompts that the command cannot be found. Don't worry. There are many commands below to check the IP. Here, this is to execute /sbin/ifconfig, and the IP can be output.
The output content is similar to the previous command, but this network card has a blank line to isolate it.
This command can actually be abbreviated. Ifconfig can be executed directly because it is placed in sbin Directory, you don’t need to enter the full path
Recommended related articles and tutorials: linux tutorial
The above is the detailed content of What is the command to check ip address in linux. For more information, please follow other related articles on the PHP Chinese website!