Homework 3
Purpose:
Practice filesystem-related commands in a Linux shell.
Look through the manual pages of the commands you use and try to
understand some of the options.
Try to use as many shortcuts you discovered in Homework 1 as
possible (copy&paste, Up Arrow, etc). Typing is a waste of time.
1. Open several terminal windows and a web browser displaying
this page.
2. Make a test directory (see mkdir), and change to that directory
(see cd). Look through the manual pages of the commands you used and
try to understand some of the options.
3. Create a file named a in the test directory and put some
text inside. Try to figure out how to use the "echo" command to
create the file and dump the text inside. (Hint: echo "text"
> a)
4. Create a file named b in the test directory and put some
text inside. Try to figure out how to use the "cat" command to
create the file and dump the text inside. (Hint: cat > b, end by
Ctrl-D)
5. Create a file named c in the test directory and put some text
inside. Try to figure out how to use emacs or another text editor to
create the file and dump the text inside.
6. Create three directories named dd1-dd3 in the test directory and
copy the file a to dd1 (see cp).
7. Modify the text in the file b using a text editor.
8. Delete the directories dd1, dd2, and the file b (see man pages of
rm and rmdir).
9. Use ls to explore the contents of the test directory. Anything
unexpected? (Hint: look for a file named b~ - any idea where is that
coming from?)
10. Move the file a into a file named abby_goes_to_New_York (see
mv).
11. Visualize the text inside the file abby_goes_to_New_York (see
cat). Can you figure out a shortcut that will save you from typing
all that long name? (Hint try pressing a<TAB>)
12. Copy abby_goes_to_New_York into abby_goes_to_LA.
13. Visualize the contents of the file abby_goes_to_New_York using
the TAB shortcut while typing the name. Any useful observations?
(Hint: if it apparently doesn't work, explore pressing TAB twice)
14. Prevent other users from reading the contents of the file
abby_goes_to_New_York (see chmod).