Linux Commands
From HPC
Contents |
Linux Commands
Remember Linux is Case Sensitive. myscript is different to MyScript.
Files and Directories
Copy files
cp from to
Examples
cp * mywork/
Copies all files in current directory to a sub directory called mywork.
cp myfile.txt myfile.txt.backup
Copies a file in the same directory and renames that file.
Copy directories=
cp -R directory destinantion
The -R switch means recursive, meaning it will copy the contents of subdirectories as well.
Examples
cp -R dir1 dir2
This copy dir1 and it's contents to dir2. The end result is dir2/dir1/files
cp -R dir1/ dir2/
This copies the contents of dir1 (but not actually the direcory it's self) to dir2. Note dir2 must already exist. The end result is dir2/files