Some useful tips on using SSH
Setup a ~/.ssh/config
The SSH Config file has the following format
Host hostname1
SSH_OPTION value
SSH_OPTION value
Host hostname2
SSH_OPTION value
Host *
SSH_OPTION value
Instead of connecting like this everytime,
$ ssh john@dev.example.com -p 2322
You can setup your ssh config -
Host devbox
HostName dev.example.com
User john
Port 2322
And then only write
$ ssh devbox
Other programs like scp, sftp, rsync will also pull this config automatically so you can use the same aliases there as well.
scp a folder over
scp some/path/to/local/file remotehostname:/destination/on/remote/box
If you have set up an ssh alias like mentioned above, you can use that before the : in the destination path.
Run one off commands without logging in interactively
Use the following syntax -
$ ssh remotebox "some command you want to run"
For eg.
$ ssh remotebox "date"
Sun Mar 1 02:29:25 PM IST 2026