Printing the IP Address for a Device
I often work with VMs. Sometimes I want to SSH into a physical server or a laptop. Either way I need to know the IP address of the box to get work done.
This post covers a function that can be used to print the (DHCP) IP for a device on a box you are working on. If you put it in .profile, you can log into a VM or physical box to get the IP address. You can then use that to SSH into the box.
Software Versions
Instructions
Here is an sh function that can be used to print the ip address for a device. I put it in .profile.
.profile partial listing
I also have this at the bottom of .profile.
.profile partial listing
When I log in, I see something like this.
sh
A csh script (for FreeBSD root) that does the same thing looks something like this.
print_ip.csh complete listing