Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this hands-on project, you create and use an alias, as well as view and change existing shell variables. In addition to this, you export

image text in transcribed
image text in transcribed
In this hands-on project, you create and use an alias, as well as view and change existing shell variables. In addition to this, you export user-defined variables and load variables Project 7-3 automatically upon shell startup. 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? 66 6. At the command prompt, type vi.bash profile and press Enter. At the end the file, add the following lines. When finished, save and quit the vi editor. 7. At the command prompt, type exit and press Enter to log out of the shell Next, og the terminal using the user name of root and the password of LNXrocks!. When prema 8. At the command prompt, type exit and press Enter to log out of the shell. Next, logis to the terminal using the user name of root and the password of LNXrocksl. Whers 18. At the command prompt, type alias and press Enter. What aliases are present in your shell? echo -- "Would you like a hello prompt? (y) --> it SANSWER - "y1 read ANSWER then PS1-"Hello There: fi Explain what the preceding lines will perform after cach login. for a hello prompt, type y and press Enter. What prompt did you receive and 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 anv 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 LNXrocksl. 14. At the command prompt, type echo SMYVAR 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 LNXrocksl. 17. At the command prompt, type echo SHYVAR and press Enter to list the contents of the MYVAR variable. What is listed and why? 1s 19. At the command prompt, type alias asample="cd /etc ; cat hosts, cd-1 -> and press Enter. What does this command do? 20. At the command prompt, type sample 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. In this hands-on project, you create and use an alias, as well as view and change existing shell variables. In addition to this, you export user-defined variables and load variables Project 7-3 automatically upon shell startup. 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? 66 6. At the command prompt, type vi.bash profile and press Enter. At the end the file, add the following lines. When finished, save and quit the vi editor. 7. At the command prompt, type exit and press Enter to log out of the shell Next, og the terminal using the user name of root and the password of LNXrocks!. When prema 8. At the command prompt, type exit and press Enter to log out of the shell. Next, logis to the terminal using the user name of root and the password of LNXrocksl. Whers 18. At the command prompt, type alias and press Enter. What aliases are present in your shell? echo -- "Would you like a hello prompt? (y) --> it SANSWER - "y1 read ANSWER then PS1-"Hello There: fi Explain what the preceding lines will perform after cach login. for a hello prompt, type y and press Enter. What prompt did you receive and 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 anv 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 LNXrocksl. 14. At the command prompt, type echo SMYVAR 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 LNXrocksl. 17. At the command prompt, type echo SHYVAR and press Enter to list the contents of the MYVAR variable. What is listed and why? 1s 19. At the command prompt, type alias asample="cd /etc ; cat hosts, cd-1 -> and press Enter. What does this command do? 20. At the command prompt, type sample 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

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

Students also viewed these Databases questions