For example, (you should create this file in /home/vastro/tutorial/texts.)
% cat test.txt
There was a young woman named Bright
Whose speed was much faster than light.
She set out one day
In a relative way,
And returned on the previous night.
Question 8: How would you view the contents of test.txt to make sure it was saved properly?
% cp test.txt test2.txt
creates the file test2.txt which is identical to test.txt. This is a useful way to create backup copies of files on which you perform regular, but dramatic changes. That is, if you screw up, you can always go back to the most recent update.
For example, (don't perform this example)
% mv test.txt trial_texts
moves test.txt from the current directory to the subdirectory texts. Also,
% mv test.txt probe.txt
copies test.txt to probe.txt, and removes the filee test.txt. That is, you've renamed the file from test.txt to probe.txt. Finally,
% mv test.txt trial_texts/probe.txt
moves test.text to the directory text, and changes the file name to probe.txt.
% rm test.txt
removes the file we just created. However, the copy with the different name remains.
Question 9: In your own words, what is the purpose of the commands rm, cp, mv and rmdir?
Exercise 9: List the contents of the current directory. (It should be the directory /home/vastro/tutorial/data.) Notice that one file there has an unusually long name. Use mv to change this name to one analogous to pdiode_3100.dat.
Exercise 10: Go the the directory tutorial and remove the subdirectory ps using the rmdir command. What happens?
Exercise 11: Copy the file zzz.ps from the directory tutorial to the subdirectory ps and delete the copy in tutorial using rm. Repeat the process, putting zzz.ps back into the directory tutorial. Finally, put the file in ps using mv. Which process was easier?