Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer using linux. THE ANSWER I HAVE BEEN RECEVING IS NOT WHAT IM LOOKIN

ID: 3741173 • Letter: P

Question

Please answer using linux.

THE ANSWER I HAVE BEEN RECEVING IS NOT WHAT IM LOOKING FOR. thank you !

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the ter- minal using the user name of root and the password of LNXrocks!.
2. At the command prompt, type vi myscript2 and press Enter to open a new file for editing called myscript2 in your home directory.
3. Enter the following text into the myscript file. When finished, save and quit the vi editor.
#!/bin/bash echo –e "This program adds entries to a family database file. " echo –e "Please enter the name of the family member -->c" read NAME echo –e "Please enter the family member’s relation to you (i.e. mother) - ->c" read RELATION echo –e "Please enter the family member’s telephone number -->c" read PHONE echo –e "$NAME $RELATION $PHONE" >> database
4. At the command prompt, type chmod u+x myscript2 and press Enter. Next, type ./myscript2 at the command prompt and press Enter. Answer the questions with information regarding one of your family members.
5. At the command prompt, type cat database and press Enter. Was the entry from Step 4 present? Why?

6. Perform Step 4 several times to populate the database file with entries.

7. At the command prompt, type vi myscript2 and press Enter. Edit the text inside the myscript2 shell script such that it reads:
#!/bin/bash echo –e "Would you like to add an entry to the family database file? " read ANSWER1 if [ $ANSWER1 = "y" –o $ANSWER1 = "Y" ] then echo –e "Please enter the name of the family member -->c" read NAME echo –e "Please enter the family member’s relation to you (i.e.
mother)- ->c" read RELATION echo –e "Please enter the family member’s telephone number -->c" read PHONE echo –e "$NAME $RELATION $PHONE" >> database fi echo –e "Would you like to search an entry in the family database
file? " read ANSWER2 if [ $ANSWER2 = "y" –o $ANSWER2 = "Y" ] then echo –e "What word would you like to look for? -->c" read WORD grep "$WORD" database fi
8. At the command prompt, type ./myscript2 and press Enter. When prompted to enter an entry into the database, choose y and press Enter. Answer the questions with information regarding one of your family members. Next, when prompted to search the database, answer y and press Enter. Search for the name that you just entered a few seconds ago. Is it there?
9. At the command prompt, type ./myscript2 and press Enter. When prompted to enter an entry into the database, choose n and press Enter. Next, when prompted to search the database, answer y and press Enter. Search for a name that you entered earlier in Step 6. Was it there? Why?
10. At the command prompt, type vi myscript2 and press Enter. Edit the text inside the myscript2 shell script such that it reads:
#!/bin/bash echo –e "What would you like to do? Add an entry (a) Search an entry (s) Enter your choice (a/s)-->c" read ANSWER case $ANSWER in a|A ) echo –e "Please enter the name of the family member -->c"
read NAME echo –e "Please enter the family member’s relation to you (i.e.mother)- ->c" read RELATION
echo –e "Please enter the family member’s telephone number -->c" read PHONE echo –e "$NAME $RELATION $PHONE" > > database ;;
s|S ) echo –e "What word would you like to look for? -->c" read WORD
grep "$WORD" database
;;
*) echo "You must enter either the letter a or s."
;;
esac

Explanation / Answer

Please find my answer for first 6 QUestions.

Please repost others in separate post.

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the ter- minal using the user name of root and the password of LNXrocks!.

Login success.

2. At the command prompt, type touch permsample and press Enter. Next, type chmod 777 permsample at the command prompt and press Enter.

touch command is used to create empty, new files.chmod for changing the permission , there are3 classes - Owner, Group and others .3 actions we can do on any file those are - read, write execute. 777 means can do write, execute and read actions on file.
Read is 4
write is 2
Execute is 1
no permission - 0

3. At the command prompt, type ls -l and press Enter. Who has permissions to this file?

ls command is used to list the files -l opion for long listing format.Ownwer ,group and others all can access the file and can perfrm read , write and execute actions.

4. At the command prompt, type chmod 000 permsample and press Enter. Next, type
ls –l at the command prompt and press Enter. Who has permissions to this file?

chmod 000 permsample --changes the permission , 0- means no permissiones ,nobody can access the file.

5. At the command prompt, type rm –f permsample and press Enter. Were you able to
delete this file? Why?

yes able to delete this file, rm command is used to delete the file and -f option is force delete.

6. At the command prompt, type cd / and press Enter. Next, type pwd at the command prompt and press Enter. What directory are you in? Type ls –F at the command prompt and press Enter. What directories do you see?

cd is for chnage directory. pwd prints the present working directory , now am in / directory .ls -F list the directories of root ,please refere attachment for the list of directories.