Wednesday, 31 December 2014

Linux commands to get IP address and Hostname of a machine

Knowing the IP address and Host name of a machine are some very common requirements.

The command to get the IP address of a linux machine is
>ifconfig
eth0      Link encap:Ethernet  HWaddr 0A:90:74:4A:62:42
          inet addr:172.31.9.245  Bcast:172.31.15.255  Mask:255.255.240.0
          inet6 addr: fe80::890:74ff:fe4a:6242/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
          RX packets:13139146 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12665241 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10433927585 (9.7 GiB)  TX bytes:16516355937 (15.3 GiB)
          Interrupt:77

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:40162017 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40162017 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0

          RX bytes:6184024837 (5.7 GiB)  TX bytes:6184024837 (5.7 GiB)

The command to get the hostname of a linux machine is
>hostname
masternodemachine

No comments:

Post a Comment

How to check the memory utilization of cluster nodes in a Kubernetes Cluster ?

 The memory and CPU utilization of a Kubernetes cluster can be checked by using the following command. kubectl top nodes The above command...