File Permissions
cp file1 file2 is the command which makes a copy of file1 in the current working directory and calls it file2.
We are going to create a file called File1.txt in your home directory, and use the cp command to copy it to your Exercise1 directory.
First, change to your home directory using the command
cd ~
then use the cat command to create the file1.txt file with some contents. Type the lines exactly as I have, including case and punctuation. To start, type;
cat > file1.txt
When you are finished, press
[ctrl][d]
to save and exit.

The quote is from “As you like it”, Shakespeare!
Now, change your working directory to your Exercise1 directory,
cd ~/Exercise1
then copy the file you just created (~/file1.txt) to the Exercise1 directory by typing the command;
/cp ~/file1.txt .
Be careful, the format of the command is cp [source] [destination]

Look at the example above, it copies the source “~/File1.txt” to the destination “.”
Don't forget the dot at the end! Remember, in Linux, the dot means the current directory.
The above command means copy the file File1.txt to the current directory, keeping the name the same. Do a ls or ll to check that this worked.
Exercise
In your ~/Exercise1 directory, create a backup of your file1.txt file by copying it to a file called file1.bak
Then delete the file1.txt file in your home directory (not the one in the Exercise1 directory).
Last updated