![]() If you want to copy multiple files at once to a new location, you can do that in the following manner: cp file1 file2 file3 fileN target_directory This behavior can be changed with -n or -i option, explained later. Keep in mind: By default, cp commands overwrites if the target file already exists. I’ll show you how to deal with overwriting of files later in this tutorial. Which means the content of the existing target file will be changed with the content of the source file. However, if the new_file already exists, it will overwrite it without asking. In the above example, if the target_fille doesn’t exist in the target_directory, it will create target_file. cp source_file target_directory/target_file To do that, you just have to specify the source file and the destination directory or file. The simplest example would be to copy a file. Let’s see how you can use cp command for various purposes: 1. ![]() You can use it to copy multiple files and directories as well. cp can also be used to copy entire directories into a new location. ![]() It’s often called the copy command in Linux and it is actually short for copy and it does exactly as it name suggests: it copies.Ĭp is used for copying files from one location to other. One of the commands that you must know in Linux is cp. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |