Languages
[Edit]
EN

SCP and path with spaces under Linux

1 points
Created by:
Kate_C
2943

How can I copy file with spaces with SCP under Linux?

Let's say we have file with two spaces like this:

/home/my_file version 123.csv

In order to copy this file with spaces using SCP we need to:

  1. Entire path enclose in double quotes.
  2. Before each space we need to put double backslash: \\

Example of working SCP command:

scp root@123.123.123.123:"/home/my_file\\ version\\ 123.csv" .

This command will simply copy our file with spaces from server with IP: 123.123.123.123 to server from which we execute above command.

Hey 👋
Would you like to know what we do?
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.