Match in the current directory, will pass the unexpanded wildcard to Scp1 is invoked, but the current directoryĬontains no filename matching ":*.txt".Ĭ shell and its derivatives will report "no match" and The Unix shell attempts to expand the wildcard before For example, thisĪttempt is likely to fail: $ scp1 :*.txt. Watch out for wildcards in remote file specifications, as they areĮvaluated on the local machine, not the remote. It simply lets the shell expand them: $ scp *.txt : Handling of Wildcards scp for SSH1 and OpenSSH has no special supportįor wildcards in filenames. Only if username is omitted and path is presentħ.5.2. $ scp as above, but copying from bob's to jen's account Table 7-3 summarizes the syntax of an Here are a few complete examples: $ scp myfile myfile2 Path) The file ~bob/dir/MyFile on The file /dir/MyFile on (although youĪuthenticate as bob, the path is absolute) #2000: The remote user's home directory on, via TCP port 2000 Home directory on :/dir/MyFile The file /dir/MyFile on (note the absolute The trailing colon again) The file ~bob/MyFile on :dir/MyFile The file dir/MyFile in the remote user's The current directory on localhost : The directory ~username on A local file named "" (oops: did youįorget the trailing colon - a common mistake) :MyFile The file MyFile in the remote user's homeĭirectory on The directory ~bob on A local file named (oops forgot
MyFile on localhost MyDirectory The directory. Either the hostname (2) or the directory path (3) must be present. If omitted entirely, the path isĪlthough each field is optional, you can't omit them all at the Relative to the default directory, which is theĬurrent directory (for local paths) or the user's homeĭirectory (for remote paths). (Optional if the hostname is present.) Relative pathnames are assumed The directory path to the file or directory.Optional TCP port number for the SSH connection toīe inserted between the hostname and the colon, preceded by a hash Present, and the username isn't if omitted, the value is The hostname of the host containing the file orĭirectory, followed by a colon.The value is the username of the user invoking Or directory, followed by This part is optional and if omitted, The username of the account containing the file.Name-of-destination may have the following form As your multiple files get copied into a singleĭestination file, each is overwritten by the next. "must," but technically you may specify a file as aĭestination in some cases. In other words, multiple files and directories may be copied only If name-of-source is two or more files, one orĭirectory into which the copy takes place.May be copied to another file or into a directory. Name-of-destination may be a file (existing or Manner (it is fairly consistent with the behavior of Unix The command line represents files or directories in the following General: scp name-of-source name-of-destinationĮach of the two names, or path specifications, on We've described the syntax of scp only in