To copy a file into another directory, use the
cp command with the file name as the first argument, and the target path name as the second.
$ cp fileName destination
You may rename the file by attaching it to the end of the path.
$ cp fileName destination/newFileName
This takes a file, and sends a copy of it to the specified path, with the new file name.
And to copy into the same directory with a new name:
$ cp fileName newFileName
To copy directories and the contents within, we must apply the
-r option, which is the command to copy recursively.
The following command would copy all contents of dir1 into dir2.
$ cp -r dir1 dir2
We can copy multiple items at once into a directory. As long as the last argument is the path name, we're good.
$ cp file1 file2 file3 pathName
Here are some additional options for fine-tuning.
This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.$ Check price
In this completely revised second edition of the perennial best seller How Linux Works, author Brian Ward makes the concepts behind Linux internals accessible to anyone curious about the inner workings of the operating system. Inside, you'll find the kind of knowledge that normally comes from years of experience doing things the hard way.$ Check price