In: Computer Science
guide to unix using linux / 4th edition / chapter 2 / p10
2.10 Assume that you work for a company that is developing a telephone database and you are creating directories for the Mail and Receiving Departments, which are referenced in the company’s budget and accounting systems as departments 4540 and 4550. After you create the directories, you begin creating files of department phone numbers to store in those directories. You must use the mkdir (make directory) command to create new directories and then use the cat command to create the phone files. Also, do not delete the files you create because you may use them in other projects. To create new directories and phone files:
Type _____________ and press Enter to go to your home directory.
Type ____________________ and press Enter to make a new directory called dept_4540.
Type _____________ and press Enter to view all directories in this area. What do you see? _____________________________________________________
Type ___________________ and press Enter to change to the new directory.
Now, use the cat command to create a file
called phones1. The phones1 file contains fields
for area code, phone prefix, phone number, last name, and first
name. A colon (:) separates each field. Following are the lines
that must be entered into the phones1 file:
219:432:4567:Harrison:Joel
219:432:4587:Mitchell:Barvara
219:432:4589:Olson:Timothy
Now, type ___________________ and press Enter to view and verify the contents of the phones1 file you created.
Type ________________ and press Enter to return to your home directory.
Type _______________________ and press Enter to make a new directory called dept_4550.
Type ______________________ and press Enter to view all directories in this area. What do you see? __________________________________________
Type ______________________ and press Enter to change to the new directory created in step h above.
Use the cat command to create the file
phones2, which contains the same fields as the
phones1 file. Following are the lines that must be entered
into the phones2 file:
219:432:4591:Moore:Sarah
219:432:4522:Polk:John
219:432:4501:Robinson:Lisa
Type ____________________ and press Enter to view and verify the contents of phones2 file.
Type ________________ and press Enter to clear
the screen for the next project.
Type cd home and press Enter to go to your home directory.
Type mkdir dept_4540 and press Enter to make a new directory called dept_4540.
Type ls -lrt and press Enter to view all directories in this area. What do you see? We will see all the existing directories and files present in that area.
Type cd dept_4540 and press Enter to change to the new directory.
Type cat phones1 to create a new file and also to open that file,
First type i to enter into insert mode;
now type the data in that file as follows:
219:432:4567:Harrison:Joel
219:432:4587:Mitchell:Barvara
219:432:4589:Olson:Timothy
after typing the text close the file.(closing the file: click esc button in keyboard and type :wq to write and quit from that file.)
Now, type less phones1 and press Enter to view and verify the contents of the phones1 file you created.(Type q to exit from the file.)
Type cd .. and press Enter to return to your home directory.
Type mkdir dept_4550 and press Enter to make a new directory called dept_4550.
Type ls -lrt and press Enter to view all directories in this area. What do you see? We will see all the existing directories and files present in that area.
Type cd dept_4550 and press Enter to change to the new directory created in step h above.
Type cat phones2 to create a new file and also to open that file,
First type i to enter into insert mode;
now type the data in that file as follows:
219:432:4591:Moore:Sarah
219:432:4522:Polk:John
219:432:4501:Robinson:Lisa
after typing the text close the file.(closing the file: click esc button in keyboard and type :wq to write and quit from that file.)
Type less phones2 and press Enter to view and verify the contents of phones2 file.( Type q to exit from the file.)
Type clear and press Enter to clear the screen for the next project.