root@172.28.19.98's password:
Last login: Tue May 24 12:03:44 2011 from 172.28.102.210
[root@localhost ~]# ipython
Python 2.6.5 (r265:79063, Jan 20 2011, 13:20:15)
Type "copyright", "credits" or "license" for more information.
IPython 0.10.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
/usr/local/lib/python2.6/site-packages/IPython/genutils.py:437: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module.
pin,pout,perr = os.popen3(cmd)
ps.get_list ps.get_nlstr ps.get_paths ps.get_spstr ps.grep
In [3]: ps.grep("inet addr")
Out[3]: SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):
0: inet addr:172.28.19.98 Bcast:172.28.255.255 Mask:255.255.0.0
1: inet addr:172.16.2.165 Bcast:172.16.255.255 Mask:255.255.0.0
2: inet addr:127.0.0.1 Mask:255.0.0.0
In [4]: ps.grep("inet addr").fields(2)
Out[4]: SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):
In [5]: ps.grep("inet addr").fields(1)
Out[5]: SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):
In [6]: ps.grep("HWaddr").fields(0,4)
Out[6]: SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):
0: eth0 00:14:85:01:DC:6A
1: eth1 00:0D:88:4A:C6:0D