Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

Displaying IP addresses

The ifconfig command displays details of every active network interface available on the system. However, we can restrict it to a specific interface using the following command:

$ ifconfig iface_name 

Consider this example:

$ ifconfig wlan0 
wlan0     Link encap:EthernetHWaddr 00:1c:bf:87:25:d2 
inet addr:192.168.0.82 Bcast:192.168.3.255 Mask:255.255.252.0 
inet6 addr: fe80::3a2c:4aff:6e6e:17a9/64 Scope:Link 
UP BROADCAST RUNNINT MULTICAST  MTU:1500 Metric:1 
RX Packets... 

To control a device, we need the IP address, broadcast address, hardware address, and subnet mask:

  •  HWaddr 00:1c:bf:87:25:d2: This is the hardware address (MAC address)
  •  inet addr:192.168.0.82: This is the IP address
  •  Bcast:192.168.3.255: This is the broadcast ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985