Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Search Forums:



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-22-2002
danhodges99
Guest
 

Posts: n/a
Bits: 0 [Banking]
Question Command for showing IP Address

Hi everyone, nice forum!
I need to know if there's a command that will show the IP Address of the machine you are logged into. Eg when you type hostname it returns the name of the machine, I need one that returns the IP address only. Can anyone help or suggest commands that are almost what I want?
Thanks.
Sponsored Links
    #2  
Old 08-22-2002
Registered User
 

Join Date: Mar 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
`ifconfig` will give you any details you want (`ifconfig -a`)... or you might be able to grab it from your /etc/hosts file...

grep `hostname` /etc/hosts |awk '{print $1}'
Sponsored Links
    #3  
Old 08-22-2002
asifraj's Avatar
Registered User
 

Join Date: Aug 2002
Location: India
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
to run ifconfig, you need to be a superuser

if not, just say

hostname -i

thanks
asif
    #4  
Old 08-22-2002
auswipe's Avatar
auswipe auswipe is offline Forum Advisor  
Registered User
 

Join Date: Nov 2001
Location: Wide Awake Wylie, Texas
Posts: 535
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally posted by asifraj
to run ifconfig, you need to be a superuser

if not, just say

hostname -i

thanks
asif
Not on all systems. I was just able to `ifconfig -a` on my FreeBSD system as a common user (not part of the wheel group).
Sponsored Links
    #5  
Old 08-22-2002
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Thanks: 0
Thanked 3 Times in 3 Posts
Linux?? for ipconfig

I guess you guys are talking Linux because I can't find that command on my HPUX system.

My commands are:

netstat -rn # shows info from the routing table.
grep `hostname` /etc/hosts





Sponsored Links
    #6  
Old 08-22-2002
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,090
Thanks: 0
Thanked 21 Times in 7 Posts
ifconfig -a on Solaris would give you the following type of info - to get the same on HP-UX you would have to do ifconfig lan1 (or specific interface - gather that info from lanscan)

$ ifconfig -a
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 1
inet 10.14.6.6 netmask fffffc00 broadcast 10.14.6.255
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 2
inet 127.0.0.1 netmask ff000000

On HP-UX:
$ lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
8/4/2/0 0x0060B0F93BA9 1 UP lan1 snap1 1 ETHER Yes 119

$ ifconfig lan1
lan1: flags=843<UP,BROADCAST,RUNNING,MULTICAST>
inet 10.14.8.2 netmask fffffc00 broadcast 10.14.8.255
Sponsored Links
    #7  
Old 08-23-2002
asifraj's Avatar
Registered User
 

Join Date: Aug 2002
Location: India
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
yes sir,

i was talking about LINUX only.
Sponsored Links
Closed Thread

Tags
linux, linux commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 08:12 PM
san lv showing old fs itik AIX 2 05-07-2008 07:50 AM
tar -xvf is showing error Renjesh Solaris 10 04-17-2008 03:50 AM
command to know the IP address suri Shell Programming and Scripting 1 03-14-2007 02:57 AM
Mac address - what is line command to find and active new card wmetz IP Networking 1 03-19-2002 03:44 PM



All times are GMT -4. The time now is 04:08 AM.