Nov 7, 2009
Pages: 1, 2

Bash Script To Display Your Ip - Script to display your ip

free web hosting

Read Latest Entries..: (Post #12) by dmnhunter on Aug 29 2009, 12:16 AM.
! /bin/bash exip=`lynx -dump http://www.Whatismyip.Com | head -and 11` #Echo "$exip"curl -o /dev/null -s -u twittername:twitpasswd -d status="$exip" http://twitter.com/statuses/update.xmlNow if you setup a misc twitter account you can send this information to you if you happen to be on the road and need to know the ip to get in.just insert your new twittername and paswd here and be sure to make those tweets private and then follow with your primary twitt...
read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > How-To's and Tutorials > Networking

Bash Script To Display Your Ip - Script to display your ip

m3th
If your behind a router , and like me too lazy to open a browser and find a site that displays your ip , heres a simple Bash script (Bash is a shell in linux, main shell in Slackware Linux)

Open a text editor , copy and paste the following:

CODE
#! /bin/bash

exip=`lynx -dump http://www.whatismyip.com | head -n 2`
echo "$exip"


Save the txt ( for the sake of agrument we will refer the file as ip.sh)
From console type:
chmod a+x ip.sh
Now run the script like so:
./ip.sh (which will display something like the following)
Your IP Is XX.XXX.XXX.XX
Done!

I will explain what we just did in the script.

!# /bin/bash <- Tells what shell we using, this line is always here but /bin/bash may be changed, depending on your system

exip=`lynx -dump http://www.whatismyip.com | head -n 2` <- We setup a variable and run some console commands, lynx is a txt mode browser the we send it to head, which takes only the first to lines.

echo "$exip" <- We echo the content of exip variable to screen

chmoding to a+x just makes the file executable..

I know there a billion ways to do this, but it gets job done ...

 

 

 


Comment/Reply (w/o sign-up)

moonwitch
You could/should also include links instead of lynx. Usually links is installed, for lynx you have to select individual packages, which not everyone does. (I do but that's not the point tongue.gif)

In any way, Links looks better than lynx. And the speed of both is the same smile.gif

It's not a very long tutorial but it's nice.

Comment/Reply (w/o sign-up)

jet
Nice tutorial.. Though my IP changes every once in a while and I've never had to know it for anything. But if we ever get stuck in linux and need to know .. smile.gif

Comment/Reply (w/o sign-up)

OldSkuBoi
lol nice tuturial. I would use it but, my ip stays the same. Been the same ip for like over 1 year. Maybe i should reset my ip.

Comment/Reply (w/o sign-up)

saneax
nice script..I find it usefull.. good work!

Comment/Reply (w/o sign-up)

SiriusRo
Does this display my ip address or the person who is looking at the script's ip address, or does it show everyone my ip address

Comment/Reply (w/o sign-up)

toby
Bash is non-windows Command Prompt.

Nice idea, I'm surprised it works.

Comment/Reply (w/o sign-up)

ethergeek
QUOTE(moonwitch @ May 27 2005, 01:17 AM) *
You could/should also include links instead of lynx. Usually links is installed, for lynx you have to select individual packages, which not everyone does. (I do but that's not the point tongue.gif)

In any way, Links looks better than lynx. And the speed of both is the same smile.gif

It's not a very long tutorial but it's nice.


Why lynx? wget is more common on unix based default installs these days than lynx or links or elinks (or any other text browser for that matter).

Comment/Reply (w/o sign-up)

FeedBacker
Null password at Freewebs
Bash Script To Display Your Ip

I accidentally pressed Enter key without assigning a new password in my freewebs.Com site. Now they say my password is "null".

Any help available to recover my site?

-reply by Cherian

Comment/Reply (w/o sign-up)

darkken
Why can't you use ifconfig built-in to display the ip address. Simple and works great.

Comment/Reply (w/o sign-up)

Latest Entries

dmnhunter
! /bin/bash

exip=`lynx -dump http://www.Whatismyip.Com | head -and 11`
#Echo "$exip"
curl -o /dev/null -s -u twittername:twitpasswd -d status="$exip" http://twitter.com/statuses/update.xml




Now if you setup a misc twitter account you can send this information to you if you happen to be on the road and need to know the ip to get in.

just insert your new twittername and paswd here and be sure to make those tweets private and then follow with your primary twitter account.


I use this from everything to knowing if root logs in to server powerdown and reboots.......

Very handy.



Comment/Reply (w/o sign-up)

iGuest
re: darkken
Bash Script To Display Your Ip

darkken: ifconfig gives you your internal IP (ie. The one your router gave you). If you want your network's external IP (ie. The one the internet sees), then the only real way is with external websites.


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : Bash Script Display Ip Script Display Ip


    Looking for bash, script, display, ip, script, display, ip

See Also,

*SIMILAR VIDEOS*
Searching Video's for bash, script, display, ip, script, display, ip
advertisement



Bash Script To Display Your Ip - Script to display your ip

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com