Friday 26 July 2019

Unix Commands: cp (Copy)

cp

cp(Copy) :To copy the file contents of one file to
another
> cp filename1 filename2
This will copy content of filename1 to filename2  
Both the files should be in the same directory.

> cp dir1/filename1 dir2
  To copy the contents of filename1 of dir1 to the filename1 of dir2 directory

> cp ../filename1 filename1
  To copy content of filename1 from parent directory to current directory as filename1

> cp –r dir1 dir2

  To copy directory from one location to another.

No comments:

Post a Comment