SSH cp command

The cp command stands for copy and is used to copy content like files in a Linux system. We’ll show some basic usage of the SSH cp command in the article below:

Simple copy with SSH cp command

cp myFile.ext /path/to/newFile.ext

WildCard cp usage

This will copy all files in the current directory that end with .ext

cp *.ext /path/to/store/newFiles/

Copy directory with SSH cp command

This will copy all the content of the folder directory and it’s structure with files to the newDirectory

cp -R /path/to/directory /path/to/newDirectory

Copy with keeping the parent directory structure

This will create a file in the following dirStructure /path/to/newDir/currentDir/path/to/

cp --parents ./currentDir/path/to/copyFile /path/to/newDir
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Linux tar Command

The Linux tar command is used to compress and extract files to and from an archive. In this...

How to Install WordPress via SSH

Since WordPress is the most widely used CMS it’s installation process has been made as simple and...

SSH Execute Command on a Remote server

Via SSH you can connect to a remote server’s shell. This will allow you to execute commands on...

How to connect to your shared hosting account via SFTP with FileZilla

SFTP is a convenient way to use SSH, while also using the interface of a simple FTP. In order to...

SSH netstat command

If you wish to debug or track statistics of your network in a Linux environment you can use SSH...