Copy Command in Linux the FIle and Folder




How to Copy files and folders in Linux
Using Linux without a desktop is a challenge for those of you who like to mess around with Linux.

This is because a lot of the commands if you don't know the command that should be given then you definitely confused.

One of the simple but often forgotten is the copy command.

The copy command is the command that is simple but so important.

I often forget this command and always looking for a reset command just to find the copy of the directory.



How To Copy Folder File Linux
To copy files in Linux are basically using the following command:
cp from to

Suppose you want to copy the test.txt file that is located in the folder "/home/azhar/" to the directory "/home/azhar/folder/" then the command use:
cp /home/azhar/test.txt /home/azhar/folder/

If an error occurred, then make sure you are logged in as root, or use sudo.

Copy The Linux Folder
To copy a folder, you need to add the parameter "-r" (do a recursive directory copy), so his command to be:
cp -r /home/raymond/from_folder /home/raymond/to_folder/

Copy with other parameters
Other parameters that can be used also for example is:
-a copy retain by owner, timestamps, dl
-v displays the description of the copy process is done

Example:
cp -avr /home/raymond/from_folder /home/azhar/to_folder/


Next
Previous
Click here for Comments

0 comments: