Move command is used to move a file or directory from one place to another place.
Syntax : cp [-opt] source destination
cp source path_to_destination copy a file into another
cp *.txt dir_name copy a file to another directory
cp file1.txt file2.txt dir_name copy file1.txt and file2.txt to another directory
cp -r dir1 dir2 copy several files into a directory
cat fil1 fil2 > fil3 concatenates fil1 and fil2, and places
the result in fil3
Syntax : mv [-opt] source destination
moving files & directories
mv [opt] file1 file2
mv [opt] dir1 dir2
mv [opt] file dir
Example:
mv -i file1 file2 file3 dir1 #move the files file1,file2,file3 into the directory dir1
mv dir1 dir2 #move the directory dir1 to dir2
No comments:
Post a Comment