![]() ~]# echo "testing3" > /tmp/testdir/testfile3 The destination can either be the directory you wish to copy the source directory into, or it could be a newly named directory. We can also copy a whole directory, simply specify a directory as the source rather than a file name. As shown when we check the contents of the newly copied /root/test file, they contain the “testing” string which we placed into the original /tmp/test file.īy default if no destination file is specified, the source file name is used, however we can specify the destination file name to be something different if we like, the contents of the file will be the same though. This will copy the source file at /tmp/test to the directory /root/test. ![]() For example, say we want to copy the /tmp/test file to /root, this would be done as follows. The ‘cp’ command works by specifying a source followed by the destination. Note: The term ‘directory’ is simply Linux speak for ‘folder’ in Windows. Here we will demonstrate some common examples in which ‘cp’ can be used. In Linux we can copy files and directories around with the ‘cp’ command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |