Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Boot your Fedora Linux virtual machine. After your Linux system has been loaded, switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in

Boot your Fedora Linux virtual machine. After your Linux system has been loaded, switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal using the user name of root and the password of LINUXrocks!.

2. At the command prompt, type pwd and press Enter to view the current working directory. What is your current working directory?

3. At the command prompt, type cd and press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Why or why not?

4. At the command prompt, type cd . and press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Why or why not?

5. At the command prompt, type cd .. and press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Why or why not?

6. At the command prompt, type cd root and press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Where are you now? Did you specify a relative or absolute pathname to your home directory when you used the cd root command?

7. At the command prompt, type cd etc and press Enter. What error message did you receive and why?

8. At the command prompt, type cd /etc and press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Did you specify a relative or absolute pathname to the /etc directory when you used the cd /etc command?

9. At the command prompt, type cd / and press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Did you specify a relative or absolute pathname to the / directory when you used the cd / command?

10. At the command prompt, type cd ~user1 and then press Enter. At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Which command discussed earlier performs the same function as the cd ~ command?

11. At the command prompt, type cd Desktop and press Enter (be certain to use a capital D). At the command prompt, type pwd and press Enter to view the current working directory. Did your current working directory change? Where are you now? What kind of pathname did you use here (absolute or relative)?

12. Currently, you are in a subdirectory of user1s home folder, three levels below the root. To go up three parent directories to the / directory, type cd ../../.. and press Enter at the command prompt. Next, type pwd and press Enter to ensure that you are in the / directory.

13. At the command prompt, type cd /etc/samba and press Enter to change the current working directory using an absolute pathname. Next, type pwd and press Enter at the command prompt to ensure that you have changed to the /etc/samba directory. Now, type the command cd ../sysconfig at the command prompt and press Enter. Type pwd and press Enter to view your current location. Explain how the relative pathname seen in the cd ../sysconfig command specified your current working directory.

14. At the command prompt, type cd ../../home/user1/Desktop and press Enter to change your current working directory to the Desktop directory under user1s home directory. Verify that you are in the target directory by typing the pwd command at a command prompt and press Enter. Would it have been more advantageous to use an absolute pathname to change to this directory instead of the relative pathname that you used?

15. Type exit and press Enter to log out of your shell.

Project 3-2. In this hands-on project, you navigate the Linux filesystem using the Tab-completion feature of the BASH shell.

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

2. At the command prompt, type cd / and press Enter.

3. Next, type cd ro at the command prompt and press Tab. What is displayed on the screen and why? How many subdirectories under the root begin with ro?

4. Press the Ctrl+c keys to cancel the command and return to an empty command prompt.

5. At the command prompt, type cd b and press Tab. Did the display change?

6. Press the Tab key again. How many subdirectories under the root begin with b?

7. Type the letter i. Notice that the command now reads cd bi. Press the Tab key again. Which directory did it expand to? Why? Press the Ctrl+c keys to cancel the command and return to an empty command prompt.

8. At the command prompt, type cd m and press Tab. Press Tab once again after hearing the beep. How many subdirectories under the root begin with m?

9. Type the letter e . Notice that the command now reads cd me. Press Tab.

10. Press Enter to execute the command at the command prompt. Next, type the pwd command and press Enter to verify that you are in the /media directory.

11. Type exit and press Enter to log out of your shell.

Project 3-3. In this hands-on project, you examine files and file types using the ls and file commands.

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

2. At the command prompt, type cd /etc and press Enter. Verify that you are in the /etc directory by typing pwd at the command prompt and press Enter.

3. At the command prompt, type ls and press Enter. What do you see listed in the four columns? Do any of the files have extensions? What is the most common extension you see and what does it indicate? Is the list you are viewing on the screen the entire contents of /etc?

4. At the command prompt, type ls | more and then press Enter (the | symbol is usually near the Enter key on the keyboard and is obtained by pressing the Shift and \ keys in combination). What does the display show? Notice the highlighted --More-- prompt at the bottom of the screen. Press Enter. Press Enter again. Press Enter once more. Notice that each time you press Enter, you advance one line further into the file. Now, press the spacebar. Press the spacebar again. Notice that with each press of the spacebar, you advance one full page into the displayed directory contents. Press the h key to get a help screen. Examine the command options.

5. Press the q key to quit the more command and return to an empty command prompt.

6. At the command prompt, type ls | less and then press Enter. What does the display show? Notice the : at the bottom of the screen. Press Enter. Press Enter again. Press Enter once more. Notice that each time you press Enter, you advance one line further into the file. Now press the spacebar. Press the spacebar again. Notice that with each press of the spacebar, you advance one full page into the displayed directory contents. Press the h key to get a help screen. Examine the command options, and then press q to return to the command output.

7. Press the (up arrow) key. Press again. Press once more. Notice that each time you press the key, you go up one line in the file display toward the beginning of the file. Now, press the (down arrow) key. Press again. Press once more. Notice that each time you press the key, you move forward into the file display.

8. Press the q key to quit the less command and return to a shell command prompt.

9. At the command prompt, type cd and press Enter. At the command prompt, type pwd and press Enter. What is your current working directory? At the command prompt, type ls and press Enter.

10. At the command prompt, type ls /etc and press Enter. How does this output compare with what you saw in Step 9? Has your current directory changed? Verify your answer by typing pwd at the command prompt and press Enter. Notice that you were able to list the contents of another directory by giving the absolute name of it as an argument to the ls command without leaving the directory in which you are currently located.

11. At the command prompt, type ls /etc/skel and press Enter. Did you see a listing of any files? At the command prompt, type ls -a /etc/skel and press Enter. What is special about these files? What do the first two entries in the list ( . and .. ) represent?

12. At the command prompt, type ls -aF /etc/skel and press Enter. Which file types are available in the /etc/skel directory?

13. At the command prompt, type ls /bin and press Enter. Did you see a listing of any files? At the command prompt, type ls -F /bin/* and press Enter. What file types are present in the /bin directory?

14. At the command prompt, type ls /boot and press Enter. Next, type ls l /boot and press Enter. What additional information is available on the screen? What types of files are available in the /boot directory? At the command prompt, type ll /boot and press Enter. Is the output any different from that of the ls l /boot command you just entered? Why or why not?

15. At the command prompt, type file /etc and press Enter. What kind of file is etc?

16. At the command prompt, type file /etc/inittab and press Enter. What type of file is /etc/inittab?

17. At the command prompt, type file /boot/* to see the types of files in the /boot directory. Is this information more specific than the information you gathered in Step 14?

18. Type exit and press Enter to log out of your shell.

Project 3-4 In this hands-on project, you display file contents using the cat, tac, head, tail, strings, and od commands.

1. Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5, and then log in to the terminal using the user name of root and the password of LINUXrocks!.

2. At the command prompt, type cat /etc/hosts and press Enter to view the contents of the file hosts, which reside in the directory /etc. Next, type cat n /etc/hosts and press Enter. How many lines does the file have? At the command prompt, type tac /etc/hosts and press Enter to view the same file in reverse order. The output of both commands should be visible on the same screen. Compare them.

3. To see the contents of the same file in octal format instead of ASCII text, type od /etc/hosts at the command prompt and press Enter.

4. At the command prompt, type cat /etc/inittab and press Enter.

5. At the command prompt, type head /etc/inittab and press Enter. What is displayed on the screen? How many lines are displayed, which ones are they, and why?

6. At the command prompt, type head -5 /etc/inittab and press Enter. How many lines are displayed and why? Next, type head -3 /etc/inittab and press Enter. How many lines are displayed and why?

7. At the command prompt, type tail /etc/inittab and press Enter. What is displayed on the screen? How many lines are displayed; which ones are they and why?

8. At the command prompt, type tail -5 /etc/inittab and press Enter. How many lines are displayed and why? Type the cat n /etc/inittab command at a command prompt and press Enter to justify your answer.

9. At the command prompt, type file /bin/nice and press Enter. What type of file is it? Should you use a text tool command on this file?

10. At the command prompt, type strings /bin/nice and press Enter. Notice that you can see some text within this binary file. Next, type strings /bin/nice | more to view the same content page-by-page. When finished, press q to quit the more command.

11. Type exit and press Enter to log out of your shell.

Project 3-5. In this hands-on project, you create and edit text files using the vi editor.

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