Linux 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 below:

Simple copy with cp

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 cp

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 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

Linux tar Command

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

Linux file command

The file command is used to check a file’s type and contents in Linux environment. It is most...

Linux export command

When you’re managing your shell’s variables and you wish to save them to your environment you can...

Linux su command

The su command is most commonly used to switch to another user. You will then be able to run...

Linux wc command

If you’re interested in finding the word count or lines of a file in your Linux environment you...

Powered by WHMCompleteSolution