LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-15-2006, 11:12 AM   #1
shakersort
LQ Newbie
 
Registered: Jul 2006
Posts: 1

Rep: Reputation: 0
Smile What shell command supplies IP address ?


I don't know what shell command line supplies IP address ? Please tell me !
 
Old 07-15-2006, 11:20 AM   #2
Theorist
Member
 
Registered: Jun 2006
Distribution: FC5, FC3, RHEL 3, Debian 3.1, Debian 3.0
Posts: 56

Rep: Reputation: 15
Hi shakersort,
If you want to know the IP address of the machine that you are using, run
Quote:
$ /sbin/ifconfig
With Regards,
Theorist
 
Old 07-15-2006, 11:49 AM   #3
hal8000b
Member
 
Registered: Mar 2001
Location: UK
Distribution: Mint, Arch, Debian7
Posts: 194

Rep: Reputation: 23
Quote:
Originally Posted by shakersort
I don't know what shell command line supplies IP address ? Please tell me !
You can also use "ip addr" . The command is ip soif its not in your path try /bin/ip addr
or /sbin/ip addr

anc@orac:~> /bin/ip addr
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0e:a6:8c:f3:16 brd ff:ff:ff:ff:ff:ff
inet 192.168.254.197/24 brd 192.168.254.255 scope global eth0
inet6 fe80::20e:a6ff:fe8c:f316/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
 
Old 07-15-2006, 04:00 PM   #4
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
You can spell it out instead of abbreviating too. So to find your ip address at the command line you type ip address at the command line. Damn that's just too easy! Why can't Windows be so simple? LOL

[climber@blackhole ~]$ ip address
1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: dev11254: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 00:c1:ff:3a:b3:8e brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:a3:4e:ef:7b:a1 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
inet6 fe80::214:2aff:fe1f:9c14/64 scope link
valid_lft forever preferred_lft forever
4: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
 
Old 07-15-2006, 07:20 PM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Crito
You can spell it out instead of abbreviating too. So to find your ip address at the command line you type ip address at the command line. Damn that's just too easy! Why can't Windows be so simple? LOL
Actually, the latest versions of iproute2 do not accept `ip addr' anymore. You must use `ip address' (or patch the source yourself). I'm not sure whose idea it was to change this (or even if s/he realized the consequences), and I don't have time to find out.

Last edited by osor; 07-15-2006 at 07:22 PM.
 
Old 07-15-2006, 07:27 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
If you just want the IP address of eth0 and nothing else (for example to use in a variable or script) you can use this:
Code:
ifconfig eth0 | grep "inet addr:" | awk -F: {'print $2'} | cut -d\  -f 1
You'll probably have to use the full path to ifconfig if you're not root.
 
Old 07-16-2006, 01:21 AM   #7
titanium_geek
Senior Member
 
Registered: May 2002
Location: Horsham Australia
Distribution: elementary os 5.1
Posts: 2,479

Rep: Reputation: 50
this is also the completely wrong forum for this question- I've reported it to the moderators so it can be moved to a better place. (to help other people with the problem find it easily)

titanium_geek

EDIT - apologies for harsh sounding tone. added a to make it feel happier.

Last edited by titanium_geek; 07-16-2006 at 07:15 AM.
 
Old 07-16-2006, 02:24 AM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Quote:
Originally Posted by titanium_geek
this is also the completely wrong forum for this question - I've reported it to the moderators so it can be moved to a better place
Thanks for that - I have to admit I didn't pay attention to the forum it was in, just saw it in a listing of new posts...
 
Old 07-16-2006, 01:59 PM   #9
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
Moved: This thread is more suitable in Linux - Newbie and has been moved accordingly to help your thread/question get the exposure it deserves.

--jeremy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing power supplies ministre Linux - Hardware 2 06-05-2006 01:24 AM
Multiple Power Supplies tommyr1216 Linux - Hardware 1 07-25-2005 03:42 PM
I need a second opinion about power supplies Bigg Mike Linux - Hardware 11 08-12-2004 01:51 AM
What package supplies dig? bonf Linux - Networking 2 11-07-2003 10:30 AM
Interconnect power supplies? Azriel Linux - Hardware 2 07-06-2002 11:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration