[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Machine Information under Linux

Thanks all!

It is the function unix() that I ought to have found.

Roy


"Peter J. Acklam" <pjacklam@online.no> wrote in message
news:8yiz9nm7.fsf@online.no...
> "Roy S Schestowitz"
<sch-at-danielsorogon-dot-com@use-address-before-at.com> wrote:
>
> > As a follow-up to a previous question of mine, is there a way of
> > finding out the domain name, IP address, machine name, current
> > user or any other identifier of a session under Linux?
>
> I'm not on a Linux host right now, but you can on Solaris and I
> think also on Linux use "domainname" to get the domain name:
>
>     $ domainname
>     YP.XXXX.NO
>
> Just wrap the command inside a call to MATLAB's "unix" function.
> There are several ways to get the IP address.  Here is one:
>
>     $ ifconfig INTERFACE | awk '/inet/ {print $2}' | sed 's/^addr://g'
>
> where INTERFACE is "eth0" or whatever.  You can also pick the
> first IP address from the list with
>
>     $ ifconfig -a | awk '/inet/ {print $2}' | sed 's/^addr://g' \
>         | fgrep -vx 127.0.0.1 | head -1
>
> although that's rather lengthy.  You can get the hostname with
>
>     $ (hostname || uname -n) 2>/dev/null
>
> which uses "uname -n" if "hostname" can't be found.
>
> Peter
>
> -- 
> If I made a copy of the The Digital Millennium Copyright Act,
> would that be a violation of it?        -- me


[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index