No of visitors who read this post: 255
Type: Question
Author: Anonymous
No votes yet

I am new in Linux operating system ,How can I find IP address in Linux Operating system by using shell command?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

# (Solution Accepted)

Hi , Anonymous hope the following steps will guide you in fixing of this issue.:..:
 
-->As you said that you are one of the users of the Linux to know your systems IP address or anyother information related to the network first thing is the users must have the administrator privileges.
 
-->If you are utilizing an GUI interface for your Linux/Unix machine then you need to just open the Linux/Unix shell In the prompt that you had opened type as  "ifconfig eth0 " excluding quotes and then press enter hence this  results in the listing of the information that is related to the network.
 
-->Generally users see commonly the network settings available for all their network devices when we run the "ifconfig" command.
 
-->For Home network/corporate network users the information is the IP address of your computer in your network and If your computer get connected to the Internet automatically the IP address is more likely which not be the IP address of the other people and web pages see. 
 
Thank you..:-)

#

The best way to look up your Linux IP address if you are new  to Linux is by utilizing the bash shell command. By typing the ‘ifconfig’ command you will get useful data such as the IP address and its corresponding mac address, the subnet mask and other handy information too. The best way to look up your Linux IP address is by utilizing the bash shell command. By typing the ‘ifconfig’ command you receive useful data such as the IP address and its corresponding mac address, the subnet mask and other handy information too.

 Here's the code:

/sbin/ifconfig \
   | grep '\<inet\>' \
   | sed -n '1p' \
   | tr -s ' ' \
   | cut -d ' ' -f3 \
   | cut -d ':' -f2

This will give you the IP address, in order to get the mac address then refer to the code below.

/sbin/ifconfig \
   | grep 'eth0' \
   | tr -s ' ' \
   | cut -d ' ' -f5

I believe that this will help you out,should you need further assistance i suggest you visit http://www.linuxjournal.com.