How can I get the address of my local machine?
You don't need to know your own host's IP address in order to copy files to it. Simply use scp
to copy the file from the remote host:
$ scp [email protected]:path/to/read.txt ~/path/to/newRead.txt
If you want to copy to your local host from your remote host, get your own IP address with ifconfig
and issue the following:
$ scp path/to/read.txt [email protected]:path/to/newRead.txt
where 1.2.3.4
is your local IP address. A convenient way to extract a host's IP address is using this function:
ipaddr() { (awk '{print $2}' <(ifconfig eth0 | grep 'inet ')); }
where eth0
is your network interface. Stick it in ~/.bash_profile
in order to run it as a regular command - ipaddr
.
Just adding to the answer, an easy way to tell your address (ip/domain), is to ssh into a computer you can ssh into, exit and then ssh back into it again. Most times, you'll see a welcome message like:
"Last login at xx:xxpm from you.domain.com/ip.ad.dre.ss"
I just got the shortest way around this
$ who
root pts/22 2016-12-28 13:22 (179.xx.xxx.xx)
If connected via ssh. This will display the user logged in plus the IP address