Linux Commands

From HPC

(Difference between revisions)
Jump to: navigation, search
(Copy directories=)
(Copy directories)
Line 19: Line 19:
Copies a file in the same directory and renames that file.
Copies a file in the same directory and renames that file.
-
==Copy directories==
+
===Copy directories===
  cp -R directory destinantion
  cp -R directory destinantion

Revision as of 11:41, 17 October 2008

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

Moving Files

Moving Directories

Renaming Files/Directories

Personal tools