I routinely backup my books to another computer within the same wifi,

rsync -avlu --exclude=".git" ~/Documents/Books beta@
rsync -avlu --exclude={.git,.DS_Store}" ~/Documents/Books beta@

Everytime, I should remember the ip address of destination machine.

Tried @local and @localhost but failed.

How could I use a name rather than a series of numbers?

  • I made Truck.app (an rsync app) to make this easier. Excuse the shameless plug but perhaps it will help you -> bonhardcomputing.com/truck
    – dave
    Mar 20, 2019 at 1:45

2 Answers 2


For this purpose you need to setup ~/.ssh/config file:

touch ~/.ssh/config
chmod 600 ~/.ssh/config

The content of the file should look as:

Host my-destination-host
    IdentityFile ~/.ssh/id_rsa
    User beta
    Port 22

Host another-example
    User another-user
    IdentityFile ~/.ssh/another-path/id_rsa
    Port 2233
    RemoteForward 6900
    RemoteForward 3389
    Compression yes
    CompressionLevel 6

# etc.

Once the file is saved, you will be able to ssh to beta@ by the command:

ssh my-destination-host

or for the another example - note the Tab completion is applicable for the Host names:

ssh another-exampTab ↹

Respectively most of the commands that use ssh can use the configuration file. For example rsync:

rsync -avlu --exclude=".git" ~/Documents/Books my-destination-host:~/Documents/Books

References and more examples, where the ~/.ssh/config file is used:


Why not just use the 'dot local' hostname?

rsync -avlu --exclude=".git" ~/Documents/Books beta@my-machine.local:~/Documents/Books

On the receiving machine, go to System Preferences -> Sharing. Next to 'computer name' click 'edit'. Then copy the address. Mine, for instance, is 'terminal-36.local'.

Also consider specifying --rsh=/usr/bin/ssh -o AddressFamily=inet. Resolving .local hostnames to IPv6 has always caused me bother (but perhaps you'll be luckier).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.