Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. 2. At the command prompt, type set | less and press Enter to view the BASH shell environment variables currently loaded into memory. Scroll through this list using the cursor keys on the keyboard. When finished, press q to quit the less utility. 3. At the command prompt, type env | less and press Enter to view the exported BASH shell environment variables currently loaded into memory. Scroll through this list using the cursor keys on the keyboard. Is this list larger or smaller than the list generated in Step 2? Why? When finished, press q to quit the less utility. 4. At the command prompt, type PS1="Hello There:" and press Enter. What happened and why? Next, type echo $PS1 at the command prompt and press Enter to verify the new value of the PS1 variable. 5. At the command prompt, type exit and press Enter to log out of the shell. Next, log in to the terminal using the user name of root and the password of LNXrocks!. What prompt did you receive and why? How could you ensure that the Hello There: prompt occurs at every login?

6. At the command prompt, type vi.bash_profile and press Enter. At the bottom of the file, add the following lines. When finished, save and quit the vi editor. echo e "Would you like a hello prompt? (y/n) -->\c" read ANSWER if [ $ANSWER = "y" ] then PS1="Hello There: " fi Explain what the preceding lines will perform after each login. 7. At the command prompt, type exit and press Enter to log out of the shell. Next, log in to the terminal using the user name of root and the password of LNXrocks!. When prompted for a hello prompt, type y and press Enter. What prompt did you receive and why? 8. At the command prompt, type exit and press Enter to log out of the shell. Next, log in to the terminal using the user name of root and the password of LNXrocks!. When prompted for a hello prompt, type n and press Enter to receive the default prompt. 9. At the command prompt, type MYVAR=My sample variable and press Enter to create a variable called MYVAR. Verify its creation by typing echo $MYVAR at the command prompt, and press Enter. 10. At the command prompt, type set | grep MYVAR and press Enter. Is the MYVAR variable listed? Why? 11. At the command prompt, type env | grep MYVAR and press Enter. Is the MYVAR variable listed? Why? 12. At the command prompt, type export MYVAR and press Enter. Next, type env | grep MYVAR at the command prompt and press Enter. Is the MYVAR variable listed now? Why? 13. At the command prompt, type exit and press Enter to log out of the shell. Next, log in to the terminal using the user name of root and the password of LNXrocks!. 14. At the command prompt, type echo $MYVAR and press Enter to view the contents of the MYVAR variable. What is listed and why? 15. At the command prompt, type vi.bash_profile and press Enter. At the bottom of the file, add the following line. When finished, save and quit the vi editor. export MYVAR=My sample variable 16. At the command prompt, type exit and press Enter to log out of the shell. Next, log in to the terminal using the user name of root and the password of LNXrocks!. 17. At the command prompt, type echo $MYVAR and press Enter to list the contents of the MYVAR variable. What is listed and why? 18. At the command prompt, type alias and press Enter.What aliases are present in your shell? 19. At the command prompt, type alias asample=cd /etc ; cat hosts ; cd ~ ; ls F and press Enter. What does this command do? 20. At the command prompt, type asample and press Enter. What happened and why? What environment file could you add this alias to such that it is executed each time a new BASH shell is created? 21. Type exit and press Enter to log out of your shell. 342 Chapter 7 Working with the BASH Shell Copyright

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago