Jump to content
  • Cowboy Denny
    Cowboy Denny

    scp

       (0 reviews)

    SCP Linux Command – How to SSH File Transfer from Remote to Local

    SCP Syntax

    scp [OPTIONS] [[user@]src_host:]file1 [[user@]dest_host:]file2
    • scp - It initializes the command and ensures a secure shell is in place.
    • OPTIONS - They grant different permissions depending on how they have been used. Some of the most common options include:
    • P(Caps) - specifies the port to establish connection with the remote host.
    • p(lowercase) - preserves the times-tamp for ease of modification and access.
    • r - copies the entire directory recursively
    • q - copies files quietly, doesn't display the progress messages. Also known as quiet mode.
    • C - for compression of data during transmission.
    • To understand more about OPTIONS read scp options
    • src_host - where the file is hosted. The source can either be a client or server depending on the origin of the file.
    • dest_host - where the file will be copied to.

    Examples

    Copy File from Local Host to Remote Host

    scp test.txt user@destination:/location

    Copy all files ending in php to Remote Host

    scp *.php user@destination:/~/
    • *.php - copies all the files with the .php extension in the currently specified folder.
    • /~/ - means copy them to the home directory.

    Copy a file with one name but save it on remote host with a different filename

    scp -P 8080 test.txt user@destination:/user/home/test2.txt

     

    Copy Files from Remote Host to Local Host

    scp <remote_username>@<IPorHost>:<PathToFile> <LocalFileLocation>

    Copy File test2.txt from Remote Host to Local Host

    scp user@remotehost:test2.txt .

    Copy Files from Remote Host to another Remote Host

    scp [email protected]:/files/test.txt [email protected]:/files

    Copy Multiple Files

    scp file1 file2 ... user@<ip_address_of_user>: Destination

    So SCP is a very powerful tool when needing to move files around between systems over the network

    User Feedback

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest

Announcements



×
×
  • Create New...

Important Information

Privacy Policy