Skip to content

Instantly share code, notes, and snippets.

@rahilwazir
Last active May 5, 2017 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahilwazir/c055164fe3efee21e921471b5869c0ed to your computer and use it in GitHub Desktop.
Save rahilwazir/c055164fe3efee21e921471b5869c0ed to your computer and use it in GitHub Desktop.
Upload file via SCP

Full version:

$ scp -i ~/.ssh/id_rsa /path/to/file.zip user@111.111.111.111:/path/to/remote/dir

Short version:

Put this in your ~/.bashrc or ~/.zshrc

upload_xyz_server () {
    scp -i ~/.ssh/id_rsa $1 user@111.111.111.111:$2
}

Then source it . ~/.zshrc or . ~/.bashrc

Usage:

upload_xyz_server /path/to/file.zip /path/to/remote/dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment