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

free web hosting
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 ...

 

 

 


Reply

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.

Reply

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

Reply

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.

Reply

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

Reply

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

Reply

toby
Bash is non-windows Command Prompt.

Nice idea, I'm surprised it works.

Reply

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).

Reply

iGuest
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

Reply

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

Reply


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*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. display ip script - 1.21 hr back. (1)
  2. bash script php - 3.81 hr back. (1)
  3. free bash script - 4.33 hr back. (1)
Similar Topics

Keywords : bash, script, display, ip, script, display, ip

  1. Parse PHP And Display PHP Generated Output
    How do you display your php output? (8)
  2. How To: Display A Members/user List.
    With PHP, Mysql, and HTML. (2)
    Alright, some of you might want to display your User's or Members on your site. Notes: 1.This
    is to fit in with Feelay's register and Log-in scripts you can find in the tutorial section. 2.I
    made this to show the members of my site who is a member and what their ID is. First off, we must
    set up a connection to our MySQL Database. CODE <?php $con =
    mysql_connect("localhost","database_username","database_username_password
    4;); if (!$con)   {   die('Could not connect: ' .
    mysql_error(....
  3. Myspacetv Download Php Script Help
    (6)
    I was trying to make a php script that can view myspace videos with jw flv player and wont to know
    how to do so if i put in
    "http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=38105626" it show the video
    "http://cache01-videos02.myspacecdn.com/11/vid_e382054c036835500bacfef1ebb5157e.flv(its the flv
    video file from myspacetv), I cant see the similarity with the links please help, thanks for viewing
    this topic /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
  4. Creating A Php Login Script
    A thorough look at the process behind it (3)
    Hey all, after reading through a fair number of tutorials on this subject I decided to write a
    pretty detailed one myself. Apologies for those who don't like my structured layout, it's
    just the way I do things. /wink.gif" style="vertical-align:middle" emoid=";)" border="0"
    alt="wink.gif" /> Title: Creating a PHP Login Script Objective: To go through a series of basic
    steps required to create a method of user registration, login and permission management using PHP
    and MySQL. Notes: The information is designed to work fully on AstaHost's hosting plans. ....
  5. Php Login Script
    (0)
    login script click the link to get your free php login script installer just follow the
    instuctions the exe gives you and it will give you the script just place the code in the sever and
    open index.html and follow on from there. what it has: it has reg page, login protection code ect.
    it is simple to use and i think quite fun but im BORN TO BE WEIRD,you will need at least one working
    mysql data base /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif"
    /> hope you enjoy it. iknow i did from the alexmedia crew....
  6. Free Login Script
    (1)
    roll up roll up get your free php login script here. it has installer, reg form,ect. see the link
    email to get the file ....
  7. Looking For Script
    need help (5)
    i am making a web site about cell phones (tones-themes-wallpapers) and i am looking for good script
    for my site with some nice options ....can any body help me /rolleyes.gif"
    style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />....
  8. Myspace Gold Script
    How to install (2)
    Hello, I have a MySpace Gold Script but do not know how to use it. Can someone help!? I have a
    MySpace gold script, this will let me build my own social networking site. I dont know much about
    MySQL or Myphpadmin. This is my installation instructions To start with open the mainfile.php and
    edit the settings to reflect your own. You will need to know your mysql database settings. If you do
    not know what these are please ask you webhost and they will provide them to you. After this file
    has been edited to your server settings, make sure that it is chmod to 444 (read ....
  9. Love Script
    (3)
    Now i personally dont think a bit of Java Script works.... To tell you who you love & the amount of
    days your going to live but I have made this script for US only that can tell the area IN US were
    you were born by entering your social security number all your information is not shored apart from
    the area you live in.... Trust me it works.......
  10. Script Request
    script request (2)
    another script request i am looking for a file manger tutorial with edit delete search upload move
    copy and a WYSIWYG(What You See Is What You Get) editer like on on freewebs.com and css editor plz
    help! i need on badly vmkrightpoint Edit"i keep search google and msn and yahoo i can't
    find on!! lol"....
  11. Auto-click Script
    (7)
    I wanna know how to make a "auto-click" script in web browser.... i want it to do this: I am on a
    web page...I have 3 options to click....so i want it to click one,after it reloads it waits for 25
    seconds and clicks 2nd,and again waits to reload and that 25 seconds and clicks 3rd option... is it
    possible to create that kind of script?it would be better if it was executable program so u can set
    it where exactly it should click... if you don't understand some of things i said tell me and i
    will "translate" it into English XD....
  12. A Simple Register Script
    This Is a Very Simple Register-Script (3)
    Some time ago, i made a login-script. But how do you use a login-script, if you can't register.
    So this morning, I decided to make a register-script.. What you should already know: The php
    basics and a little more. How to use php and mysql together. The HTML basics (to make the forms).
    The first thing we should do, is creating the database tables. Here is the code: CODE CREATE
    TABLE `user` (   `id` int(4) unsigned NOT NULL auto_increment,
      `username` varchar(32) NOT NULL,   `password` varchar(32)....
  13. Attack Script In Php
    This is a funny attack script that i made (5)
    Hey! I am going to share an attack script that i made for some time ago. I made it, as a test
    for my game.. And ofc, you can use it for your game to. It is still version 1.0. But I want you to
    learn something from it /wink.gif" style="vertical-align:middle" emoid=";)" border="0"
    alt="wink.gif" /> This is my second tutorial here, and I will try to make it better than my first
    one /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Here is
    the SQL File. CODE CREATE TABLE `characterss` (   `health` int(2....
  14. Very Simple Login-script
    This is a very simple and secure login-script (18)
    Hi. This is my first post here. please Tell me if i do something wrong. This is a very simple and
    secure login script. I will try to add as many comments as possible, to make it easier to
    understand. Lets start with the database. Just make a new SQL file, and call it whatever you want.
    Paste this code: CODE CREATE TABLE `user` (   `id` int(4) unsigned
    NOT NULL auto_increment,   `username` varchar(32) NOT NULL,   `password`
    varchar(32) NOT NULL,   `level` int(4) default '1',   PRIM....
  15. Rpg For (php)wml Script Text Based
    (1)
    Hello im newbie, Does anyone here has the script of rpg text based in wml i have a wapsite then it
    much more interesting if i will put it a game so that they will no feel bored in my site so please
    help me i know u know bout this thing hope u will help me as soon u read this topic....
  16. Help Needed To Create Windows Startup Script!
    (4)
    Hi all, I need a help from any one out here! I need to display one confirmation box using
    windows startup script! I need to run this script on each and every client system in my
    LAN! Here is the requirement: The script should ask the user to click yes to continue or no to
    exit. If the user click yes, that should open Internet Explorer with some site , Say google.com and
    after filling some forms and after closing the browser, that should bring to regular login screen
    which says, cntrl alt del to login! If the user directly preses the no button, that sho....
  17. Running Vba Script In Excel
    (6)
    Hi, I need help. Im generating a excel file using jakarta poi. I have added a vba to my excel
    template so that it creates a chart on file open using the data populated using the poi map. Now
    this works fine in a windows machine. But on a linux machine the vba does not execute. I need to
    release my prod in linux too and im losing time. Is there any workaround for this???? Thanks in
    advance Karthik....
  18. Create And Import JavaScript Modules For A Large Script
    (2)
    I have one main script which defines an object. I then have several other script files that define
    functions for that object. I have tried using the following setup to import the functions: HTML
    code snippet: <script type="text/javascript" src="/foo/mainbar.js"> <script
    type="text/javascript" src="/foo/modulebar.js"> Javascript code snippet: import
    Object.functionName; This works fine for Mozilla Firefox, but causes an error in Internet Explorer
    which causes the object to be undefined. I would like to know how better to import the functions
    into the m....
  19. PHP Tutorial: Form Verification And Simple Validation
    A One Page script for PHP form verification. (12)
    Having used various means of verifying HTML forms I believe that this method of verifying a form
    to be the best mostly because it does everything on one page. It presents the form on one page and
    then when the submit button is pressed, if all the required fields are not filled out then it will
    present the form again with all the fields intact and in red lettering will point out the fields
    that are required to be filled out in red. It is not possible to click submit using this method even
    if the user has turned JavaScript off. While it is possible to use javascript to ....
  20. Need Help With A PHP - MySQL Registration Script
    Wont INSERT into the database (13)
    hey well can some one helpme make this code work it won't INSERT INTO THE DATABSE CODE
    <?php # register1.php # common include file to MySQL include("DB.PHP");
    $Username=$_POST['Username'];
    $Password=$_POST['Password'];
    $Name=$_POST['Name']; $Last=$_POST['Last'];
    $Sex=$_POST['Sex']; $Month=$_POST['Month'];
    $Day=$_POST['Day']; $Year=$_POST['Year&....
  21. How Can I Create A "number Of Visitors" Script
    (8)
    Sorry, I am rather new on this forum, so I'm not quite sure it's the best place to ask this
    question, maybe a moderator should move my post to a more accurate subforum. However, I really would
    like to have this info. How can I add a counter in my page, counting the people visiting my webpage
    ? Is there a script "ready for use" somewhere on astahost ? Regards Yordan....
  22. Help Needed To Create Login Script With Perl/cgi
    Need Script (21)
    Have a format in mind and have a good idea how it works. So here what I need: step 1::: person must
    register: create handle // enter password // enter password // enter email : it then takes the
    person to acsepted page or reject per reason page. step 2::: login page: enter handle // enter
    password : takes them on it to the site of their control pages for each handle controls their own
    pages yet all pages interacts with the others. or bad password re login page. Have the page
    designed already have the script in html lang but one can create a password on the html page but....
  23. Question About Asp Now() Function
    How to display 24 hour time format (6)
    I am learning asp currently. The learning environment is windows 2003 plus the builtin IIS. Time
    format in this machine is set to 24 hours format (hh:mm:ss). However, when i call the Now()
    function in a ASP script, the time it caught and displayed as "2005-7-29 7:32:40pm". Is there
    anyway to make it displayed in 24 hours format.?? Just like this "2005-7-29 19:32:40" ....
  24. Disable Display Properties Tabs
    (2)
    How to disable Display Properties Tabs for security purpose? 1) Run registery editor, for this,
    type regedit in Run dialog box from start menu. 2) Find following address: HKEY-CURRENT-USER \
    Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System
    3)Create a new DWORD (value of 1) and : 3-1) to disable ScreenSaver tab name it NoDispScrSavPage
    3-2) to disable Desktop tab name it NoDispBackgroundPage 3-3) to disable Themes tab name it
    NoThemesTab 3-4) to disable Setting tab name it NoDispSettingsPage 3-5) to dsable Appearance and T....
  25. How To Save A Image In Pdf File And Download It?
    Programming script need hepl. (10)
    Can anyone tell how to save an image into a PDF file and download it without need to save it on the
    server? Thanks. All sugesstions are welcome! Wrong section. Topic moved to Software >
    Graphics & Web Design. ....
  26. Coppermine Random Image Script
    (6)
    hi i need a script to display random image of coppermine on my index....
  27. Php Script To Download File From Another Site
    (9)
    hi i need a php or java script code for downloading files from other sites to my site for example:
    http://download.com/file.zip to http://mysite.com/file.zip thanks....
  28. PHP: Writing A Generic Login And Register Script
    (13)
    Now there are basically 3 functions that a user management system provides: login, register, and
    protection. A user management system can do more than this but that is all that this tutorial will
    be covering. I will try to explain what I am doing as I go along but to fully understand what is
    happening you should have a basic knowledge of PHP, SQL, and HTML. This tutorial assumes you are
    using MySQL, adjust accordingly for a different DBMS. First off lets define the database table
    where our users will be stored. Using phpMyAdmin run this statement to create our table....
  29. How To Make A Text Based Online Game Script ?
    (22)
    Does anyone know if there is a easy was to make a text base online game, Like a free templet, or if
    anyone know how to make one and can help me.....
  30. Volume Control icon disappeared
    Can't display VolCtrl icon in taskbar (6)
    My Volume Control icon disappeared. I went to Control Panel and choosed Sounds and Audio devices
    properties and when I opt for 'Place Volume icon in the taskbar' I got this error message
    (see the pic below): What can I do to have it back in the taskbar?....

    1. Looking for bash, script, display, ip, script, display, ip

Searching Video's for bash, script, display, ip, script, display, ip
Similar
Parse PHP
And Display
PHP
Generated
Output - How
do you
display your
php output?
How To:
Display A
Members/user
List. - With
PHP, Mysql,
and HTML.
Myspacetv
Download Php
Script Help
Creating A
Php Login
Script - A
thorough
look at the
process
behind it
Php Login
Script
Free Login
Script
Looking For
Script -
need help
Myspace Gold
Script - How
to install
Love Script
Script
Request -
script
request
Auto-click
Script
A Simple
Register
Script -
This Is a
Very Simple
Register-Scr
ipt
Attack
Script In
Php - This
is a funny
attack
script that
i made
Very Simple
Login-script
- This is a
very simple
and secure
login-script
Rpg For
(php)wml
Script Text
Based
Help Needed
To Create
Windows
Startup
Script!
Running Vba
Script In
Excel
Create And
Import
JavaScript
Modules For
A Large
Script
PHP
Tutorial:
Form
Verification
And Simple
Validation -
A One Page
script for
PHP form
verification
.
Need Help
With A PHP -
MySQL
Registration
Script -
Wont INSERT
into the
database
How Can I
Create A
"number
Of
Visitors&quo
t; Script
Help Needed
To Create
Login Script
With
Perl/cgi -
Need Script
Question
About Asp
Now()
Function -
How to
display 24
hour time
format
Disable
Display
Properties
Tabs
How To Save
A Image In
Pdf File And
Download It?
-
Programming
script need
hepl.
Coppermine
Random Image
Script
Php Script
To Download
File From
Another Site
PHP: Writing
A Generic
Login And
Register
Script
How To Make
A Text Based
Online Game
Script ?
Volume
Control icon
disappeared
- Can't
display
VolCtrl icon
in taskbar
advertisement




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



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE