全部博文(184)
分类: LINUX
2009-04-20 21:59:36
ifconfig eth0 | grep -o "addr:[0-9.]*" | grep -o "[0-9.]*" |
You off course need the necessary rights to us this. If you lack the rights, you might want to prepend it with "sudo" and add the ifconfig to the allowed paswordless commands for the user that needs this..
Ifconfig retrieves the adress; the first grep weeds out the external adress out of the data & the last grep filters out the IP adress.