Novice 10: Copying files¶
Copying files can achieved with the cp (copy) command. Remember to always specify a source and a target location. Let's create a copy of one of the files created in the previous step:
[learner learning_linux]$ cp earth.txt mars.txt
[learner learning_linux]$ ls
earth.txt heaven.txt mars.txt
What if we wanted to copy files from a different directory to our
current directory? Let's put a file in our home directory (specified by
~
remember) and copy it to the current directory, learning_linux
:
[learner learning_linux]$ touch ~/jupiter.txt
[learner learning_linux]$ ls ~
directory1 file1 jupiter.txt learning_linux
[learner learning_linux]$ cp ~/jupiter.txt .
[learner learning_linux]$ ls
earth.txt heaven.txt jupiter.txt mars.txt