Channel | Publish Date | Thumbnail & View Count | Actions |
---|---|---|---|
| Publish Date not found | ![]() 0 Views |
To find the IP address of a Linux system in a short line, you can use the following command:
ip addr show | grep ‘inet ‘ | awk ‘{print $2}’ | cut -f1 -d’/’
Here’s what each part of the command does:
ip addr show : displays information about network interfaces on the system.
grep ‘inet ‘ filters the output of the previous command to show only lines containing the string ‘inet ‘, which indicates an IPv4 or IPv6 address.
awk ‘{print $2}’ extracts the second field (the IP address) from the filtered output.
cut -f1 -d’/’ removes the subnet mask from the IP address by using the ‘/’ character as the delimiter and printing only the first field.
Please take the opportunity to connect and share this video with your friends and family if you find it useful.