You are on page 1of 4

ITU – UNIX Operating System

Homework Assignment #2

In this assignment, you’re going to practice navigating the file system and
performing basic file manipulations. Fill in your answers (the commands
that you used) as you follow the instructions below:

1. Launch the Terminal application.


2. In your home directory, enter: touch bird--- A file with
name’bird’ is created
3. Make three copies (one at a time) of your bird named robin, gull,
hawk
______CP bird robin___________________
_________CP bird gull________________
____________CP bird cherly_____________

4. Make three subdirectories (one at a time): Able, Baker, Charly


____MKDir able_____________________
_____ MKDir Baker ____________________
_______ MKDir cherly __________________

5. From your home directory, copy robin and gull (one at a time) into Able
____cp robin early_____________________
_______cp gull able__________________

6. Move (not copy) hawk into Baker _MV hawk


Baker______________________

7. Verify that the results are as expected _____yes_______________

8. Make Charly the current directory _________CD


charly________________

9. WITHOUT leaving Charly, Copy robin from the parent directory into the
current directory. Use “.” to abbreviate the current directory _________CP
../robin._______________

10. WITHOUT leaving Charly, Copy hawk from Baker directory into the
current directory ______CP ../baker/hawk.____________

11. WITHOUT leaving Charly, copy hawk from Baker to Able ___CP
../Bker/hawk ../able___________________

12. Remove all the files in Able (there are several correct solutions).
_____RM_r able____________________
13. Remove the directory Able RMDIR able_________________________

14. Return to the home directory ____CD___________________

/
bin

cp
etc

home

Beth

Dan

Alex

bin

csis82

csis80

bin

csis10A

task

log.txt
assign.txt
todo.txt

15. Assume you have access to all the directories in the above tree. Using
absolute pathnames, list the contents of

a.Alex’s home directory __ls-l


/home/alex_______________________
b.Dan’s task directory __ls-l
/home/dan_________________________
c.the /bin directory _ls-l /bin____________________________

16. If you are in Dan's csis80 directory, using relative path names, change
directory to

a. the task directory__CD


bin/CSIS10A/task____________________
b. Dan's home directory directory __cd
$home________________
c. Beth's csis82 directory (don't use ~)
______CD../__________________

17. Using absolute pathnames, copy todo.txt into the csis82 directory
_______CP todo.tnt
/bin/beth/csis82______________________________________________

18. Using relative path names from directory Alex, copy log.txt into the
csis10A directory ______cp log.tnt
../alex/bin/csis82/csis10a______________________________

19. Assume that your Documents folder is the current directory. Create a
diagram of the directory structure that would result from performing the
following sequence of commands. (Hand draw a tree structure using a
format like the example in problem 10 from assignment 1.)

mkdir Foods
cd Foods
mkdir Soups
cd Soups
mkdir Chowders
cd Chowders
touch clam
touch corn DOCUMENTS
FOODS
cd ..
cd .. SOUPS
mkdir Breads
cd Breads CHOWDERS
touch sourdough
touch naan CLAM
cp -i naan ../Soups/ CORN
cd ..
mkdir Desserts
cd Desserts BREADS
mkdir Pie SOUR DOUGH
mkdir Pie/Fruit MAAN
touch Pie/Fruit/apple
mkdir Cake
touch carrot
mv -i carrot Cake
cd Pie
touch mud
cd ../..
mkdir Trail
touch Trail/gorp
touch Breads/cinnamon
rm -i Breads/sourdough

You might also like