217k views
1 vote
One of the files you should now have in your fileAsst directory is TweedleDee/hatter.txt. Suppose that you wished to copy that file into your current (commandsAsst) directory. What command would you give to make that copy?

For this, and for the following questions,

You will want to delete all files already in your commandsAsst directory before trying to check your answer to this question. Otherwise you will not be able to easily tell what files were added by your command and what were left over from earlier attempts.

For the same reason, when you submit your suggested answer to the grading script, it will delete any files in your commandsAsstdirectory before trying out your command.

User Blessed
by
6.1k points

1 Answer

1 vote

Answer:

cp /path/to/source.txt .

is the general format of copying a file to the current directory

cp ~/UnixCourse/fileAsst/TweedleDee/hatter.txt .

You can refer to the current directory with a dot (.)

Step-by-step explanation:

First, we would like to delete all files in our current directory (commandsAsst directory). To delete the files inside the directory, we would run the following command:

rm -r commandsAsst/*

This command delete the files recursively. Usually, the command for deleting is rm -r. The operator * run rm -r on every file or directory within commandsAsst.

User Gbronner
by
4.8k points