From: Jason Price <jprice@cyberbuzz.gatech.edu>
To: William Scott <wgscott@chemistry.ucsc.edu>, zsh-users@sunsite.dk
Subject: Re: how do I find my IP address
Date: Sun, 13 Jun 2004 23:37:08 -0400 [thread overview]
Message-ID: <20040613233708.A28043@redfish.gatech.edu> (raw)
In-Reply-To: <67BDB808-BDA2-11D8-9044-000A957D73C4@chemistry.ucsc.edu>; from wgscott@chemistry.ucsc.edu on Sun, Jun 13, 2004 at 06:30:23PM -0700
On most unix flavors, some varient of:
ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{print $2}'
should work. 'ifconfig' can live in various places, but usually it
is in /sbin/ifconfig or /usr/sbin/ifconfig (old unixen might have it
in /etc/ifconfig).
The 'grep inet' should give you all the ip addresses, but will also
have things like netmask. The 'grep -v 127.0.0.1' will cut out the
localhost definition. The 'awk '{print $2}' should give you just the
IP address, but it might be in a different field (try 3, 4, etc).
I'm sure there's a way to figure out a pure zsh way to do this, but I
don't know it. Also, I strongly suggest figuring this out once,
stashing it in a variable ($MY_IP or some such), and just using that
variable.
If you're under windows, under cygwin, you're on your own, but I'd
start with 'ipconfig /all'.
--Jason
On Sun, Jun 13, 2004 at 06:30:23PM -0700, William Scott wrote:
> Timothy:
>
> If you are running a computer with an ip address that changes
> (dynamically allocated), this will work, although it is kind of ugly:
>
> define an alias such as:
>
> alias myip="curl -s http://www.showmyip.com/simple/ | awk '{print $1}'
> "
>
>
>
> I would echo the output of myip into something at login rather than
> grab it off the internet every time I hit the return key.
>
>
> If you have a static ip address, you should only have to figure this
> out once. On Mac OS X you can find this in the System Preferences
> under file sharing or network settings (I am assuming this on the basis
> of the Micro$oft email stamp at the bottom of your email.)
>
> This alias and a whole bunch of stuff that is useful for OS X zsh is
> distributed by Gary Kerbaugh. I have links to it and a few of my own
> zsh functions here: http://tinyurl.com/3373b
>
> Bill Scott
>
>
> http://www.apple.com/trailers/lions_gate/fahrenheit_911/
>
>
next prev parent reply other threads:[~2004-06-14 3:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-14 1:30 William Scott
2004-06-14 3:37 ` Jason Price [this message]
2004-06-14 10:58 ` Jussi Pakkanen
2004-06-14 11:57 ` Vincent Lefevre
2004-06-14 12:23 ` James Devenish
2004-06-14 13:18 ` Vincent Lefevre
2004-06-14 3:57 ` Timothy Luoma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040613233708.A28043@redfish.gatech.edu \
--to=jprice@cyberbuzz.gatech.edu \
--cc=wgscott@chemistry.ucsc.edu \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).