Sunteți pe pagina 1din 6

Lumberg

Judy Lumberg NW105 Linux Operating Systems

KGA#2

Case Project for Outdoor Adventures


The Linux logical directory tree to organize the files for Outdoor Adventures is designed as follows: root business reports accts rec home spreadsheet files (/) dev etc word processed files general ledger

accounting data files

accts pay

1. To enter the directory tree information above into Linux, turn on your computer. After your Linux system has been loaded, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log into the terminal using the user name of root and your password. 2. At command-line prompt type, cd /, enter, to ensure that you are logged in as the root user (/). 3. Type, pwd, enter, to confirm the system directory you are currently in. 4. Type, mkdir accounting, enter, to create a directory for accounting. 5. Type, ls l, enter, to check if accounting file was entered as a file under the root.

Lumberg

6. Type, cd accounting, enter, to change to the accounting directory. 7. Type, mkdir data_files, enter, to create the subdirectory data files under the accounting folder. 8. Repeat step 7 by typing mkdir business reports, mkdir spreadsheet files, mkdir word processed files. 9. Type, cd /, enter, to change to root. 10. 11. 12. 13. 14. 15. Type, ls /accounting, enter, to view the files under accounting. Type, cd /accounting/data_files, enter. Type, mkdir accts_rec, enter. Type, mkdir accts_pay, enter. Type, mkdir general_ledger, enter. Type, cd /home, enter, to change to home directory to set up

additional users. 16. Type, useradd c owner theowner, enter, type, owner, enter,

(for password). 17. Type, useradd c accountant accountant, enter, type

accountant, enter, (for password). 18. 19. 20. 21. Type, ls /home, enter, to show list of added users in home file. To remove a user, type, rm r accountant, enter, type, y, enter. To add a group, type, groupadd g 789 company_execs, enter. To allow certain permissions for users created in step 16 and 17,

type, usermod G company_execs accountant, enter. Repeat for

Lumberg

theowner. 22. To verify the users were entered check the group list, type, cat

/etc/group, enter. 23. To verify the first five lines of the group list, type, head -5

/etc/group, enter. 24. To verify the last five lines of the group list, type, tail -5

/etc/group, enter. 25. To change permissions on the accounting folder, type, cd /,

enter to change to root directory. Type ls l, enter, to view list of root directory permissions for accounting folder. Type chmod 700 accounting, enter, to change rwx permissions to owner only. 26. To remove a directory using absolute path, type, cd

/accounting/business_reports, enter, to verify directory is empty, type, ls l, enter, to verify directory is empty. If empty, type, rmdir business_reports, enter, to remove directory. If directory is not empty, type, rmdir R business_reports, enter, to remove directory and all the files in it. 27. To add a subdirectory under business reports, type, cd

/accounting/business reports, enter. Type, touch file1, enter. Type ls l, enter, to verify file1 was added. 28. To delete a subdirectory under business reports, type, rm file3,

enter, type, y, enter, to delete file3 under subdirectory

Lumberg

business_reports. 29. To copy a file into the same directory, type, cp file1 file2, enter,

to copy file1 into file2 of the business_reports folder. Type ls R, enter, to list files in business_reports folder. 30. To copy a file to a target directory, type, at the command-line

prompt, type, cp /etc/hosts ., enter, type, ls F, enter to view copy of hosts in the root directory. 31. Vi editor is used to create a customer file that contains data

including several names, state, area code, phone, and occupation. First, create a file, then enter the data, and finally create the executable menu. At the command-line prompt, type, vi proj1, enter, press i, type clear, enter, for headings type first name, press spacebar 4 times, type last name, press spacebar 4 times, type state, press spacebar 4 times, type area code, press spacebar 4 times, type phone_number, press spacebar 4 times, type occupation, enter, enter, press esc, type :wq, enter to save input and quit editor. 32. To enter data, type vi names, enter, press i, type the 30

customer names in the same order as the headings above, with each name, etc. on a single line. After entering the last name on the list, enter, type ./menu1, enter, press esc, type :wq, enter to save input and quit editor. To display the contents of the names file, at the command-line type vi names, enter.

Lumberg

33.

To enter executable menu, type vi menu1, enter, type clear,

enter, press i, type tput cup 27 70; echo Please make a selection, enter, type tput 28 70; echo .", enter, type tput cup 29 70 enter, type echo 1. First name, enter, type tput cup 30 70 enter, type echo 2. Last name, enter, type tput cup 31 70 enter, type echo 3. State, enter, type tput cup 32 70 enter, type echo 4. Area Code, enter, type tput cup 33 70 enter, type echo 5. Phone number, enter, type tput cup 34 70 enter, type echo 6. Occupation, enter, type tput cup 35 70 enter, type echo 7. Quit, enter, type tput cup 36 70, type read x, enter, type case $x in, enter, type 1) ./1 ;; enter, type 2) ./2 ;; enter, type 3) ./3 ;; enter, type 4) ./4 ;; enter, type 5) ./5 ;; enter, type 6) ./6 ;; enter, type 7) ./7 ;; enter, type *) ./8 ;; enter, type esac, press esc, type :wq, enter. 34. Secure the file by assigning permissions to the owner only. At

the command-line, type chmod 700 menu1, enter. 35. To search the contents of a customers file with a specific last

name, at the command-line, type grep Evans names, enter. 36. To sort the names list by last name, type vi 2, enter, type clear,

enter, type sort k 2 names | more, enter, type sleep 4, enter, type ./menu1, enter, press esc, type :wq, enter. To secure the permissions on the file, type chmod 700 2, enter, type ls, enter, to view color change of file.

Lumberg

37.

To open the program, type cd media, enter, type ./menu1,

enter, type a number selection, enter for a response to your request.

S-ar putea să vă placă și