Tuesday, June 28, 2011

Copying and moving Files with cp & mv

To copy a file, follow the syntax:

$ cp my_file a_dir/file_name


Where my_file is the name of the file you want to copy and a_dir/file_name is the name and direcoty you want to use.


To copy an entire directory, follow:


$ cp -r a_dir a_dir/file_name


To move a file use the mv command, follow:


mv a_file a_dir/file_name


If you just want to rename the file just place it in the same directory.  Effectively you can also rename the file as you move it.



No comments:

Post a Comment