Try this:
Code:curl www.whatismyip.org
Try this:
Code:curl www.whatismyip.org
Main Rig: Athlon XP 2800+ (Overclocked) | 512MB Corsair DDR400 Dual Channel | Asus A7N8X Deluxe | ATi Radeon 9700 Pro
Linux Registered User - #423753
The last 2 posters should hit:
http://whatismyip.com/automation/n09230945.asp
Especially if you're using this in Conky. No need to put undue strain on their servers, and it doesn't have a restriction (or it has a much higher one) on hits in a specific time period.
Warranty? Who needs a warranty?If it ain't broke, take it apart and fix it.
What about this:
wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]|.]//g'
That seems simple enough for me. That will give you your external IP address.
This is how i did it:
Paste the following:Code:sudo gedit /bin/whatsmyip.sh
Press save and exit then:Code:#!/bin/bash echo echo "---External IP: " wget www.whatismyip.com/automation/n09230945.asp -O - -q echo echo echo "---Internal IP: " ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' echo exit 0
next:Code:sudo chmod 777 /bin/whatsmyip.sh
Paste this in the end of .bashrc file:Code:sudo gedit /home/"your username here"/.bashrc
log out and in again.Code:# Own Scripts alias whatsmyip='/bin/whatsmyip.sh'
Now you can see both your internal and external ip by typing:
You can alter the alias in the .bashrc file to whatever you feel like if you're inconvenient with "whatsmyip"Code:whatsmyip
Thanks, tturrisi for your example.
Hi All,
I tried to run the script, but sendmail is not working !
Can anybody point me to the right direction ??
The error is like the following :
Error starting sendmail: No such file or directory at /usr/bin/email_ip.sh line 17.
TQ for your help in advance.
Regards
Casey
Bro,
I just realize that I did not have sendmail install and now it show the IP and show Email sent also !!
However, the problem now is that I did not get the mail in my gmail a/c ??
Not in the SPAM box either !
Can someone shed some light !
TQ and regards,
Casey
Nice work folks...
try the code below just for fun ... it appears/seems better formatted.
#!/bin/bash
echo
echo " External IP: `wget www.whatismyip.com/automation/n09230945.asp -O - -q echo `"
echo " Internal IP: `ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`"
echo
exit 0
Keep up the good deeds![]()
Ecclesiastes 3
looking for the same thing I found that I can put this in my .bashrc file
alias out='wget -qO - http://cfaj.freeshell.org/ipaddr.cgi'
(obviously because 'in' is ifconfig)
You all have some nice scripts too, thanx
Hi, I'm raising this topic back to life because I'm too proud of the simplest thing I just made up.
I wanted to always know what was the wan IP of my home PC when I'm using my netbook anywhere else. And since I'm using Ubuntu One to instantly share small files from both, this is what I came up with:
1) Run crontab -e to edit your crontab file (cron runs commands periodically as ordered).
2) Add this line at the bottom:
* * * * * wget -rnH http://checkip.dyndns.org/ -P /home/USER/U1-SHARED-FOLDER
3) Save and enjoy...
...obviously replacing "user" and "U1-Shared-Folder" for your real folders.
The asteriscs at the beginning mean "every minute/hour/day/month/day-of-week". Since Ubuntu One will only sync it out when the local file changes in content, this doesn't create any distinguishable resource drain, at least on my PC here.
You can set proper numbers if you want to go slower: for example 0 * * * 1 for hourly, o'clock, but only on mondays... Choice is yours.
Then, on every PC that shares the Shared Folder, there will be a copy of and "index.html" file with the IP stored, adapting its content in little more than a minute of delay...
Bookmarks