There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
UNIX/Linux
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
Solved: Find connecting IP address in Linux


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
AGCurry's Avatar
Senior Member with 431 posts.
 
Join Date: Jun 2005
Location: Kansas City area
Experience: advanced but learning
10-Oct-2005, 10:45 AM #1
Solved: Find connecting IP address in Linux
I know that Linux knows and keeps track of the IP address from which I've logged in, because it tells me when I log in what address I came in from LAST.

But - is there a command which simply provides my current IP address?

Thanks in advance.
Squashman's Avatar
Distinguished Member with 12,604 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
10-Oct-2005, 11:14 AM #2
ifconfig
AGCurry's Avatar
Senior Member with 431 posts.
 
Join Date: Jun 2005
Location: Kansas City area
Experience: advanced but learning
10-Oct-2005, 11:22 AM #3
Thanks, Squashman, but ifconfig only gives me the address of the ethernet adaptor and the loopback address - and the man page for ifconfig does not seem to provide for any option to get the address of THE DEVICE FROM WHICH I AM CONNECTING.
Squashman's Avatar
Distinguished Member with 12,604 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
10-Oct-2005, 11:26 AM #4
I am not sure which device you want. If you are behind a router, look at your router config to get your Internet IP address. Or just go to http://www.whatismyip.com
AGCurry's Avatar
Senior Member with 431 posts.
 
Join Date: Jun 2005
Location: Kansas City area
Experience: advanced but learning
10-Oct-2005, 11:32 AM #5
Okay. The Linux box's network card is 172.xx.xx.xx. ifconfig gives me that address just fine.

But I'm connecting from a PC, address 10.0.xx.xx. THAT's the address I want to be able to access in a shell script. When I log on to the Linux box, there's a last-login message like "last login Tue Dec 8 blah blah from 10.0.xx.xx", so I know the information exists SOMEWHERE on the Linux server. There oughta be a command which yields it - or a file to look in, at least - but I don't know what it is.
Squashman's Avatar
Distinguished Member with 12,604 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
10-Oct-2005, 11:39 AM #6
last or lastlog
Squashman's Avatar
Distinguished Member with 12,604 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
10-Oct-2005, 11:41 AM #7
Or just type who
AGCurry's Avatar
Senior Member with 431 posts.
 
Join Date: Jun 2005
Location: Kansas City area
Experience: advanced but learning
10-Oct-2005, 12:16 PM #8
Quote:
Originally Posted by Squashman
Or just type who
Thanks! I will extract the ip address by looking for $(tty) in the list who brings back.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:40 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.