Thursday, September 30, 2010

How to get System IP using shell in various systems.

Sometime we want to retrive some IP address information about the system in a shell script.
This is how it can be done.

Linux:

  ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'

FreeBSD/OpenBSD:

  ifconfig  | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'

Solaris:

  ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2}'




Centos 7 reset root/ any user lost password / lockout due to cant remember password

1. Need to be in front of the terminal. (Physically if not vm). 2. Reboot the server 3. Press 'e' in the GRUB2 boot screen. 3. bunch...