linux chp3

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

While you are working on a report in vi, you decide to insert information from another text file in your home directory called summary_data. Which of the following commands (from command mode) enables you to add the contents of summary_data?

:r summary_data

What is the process called compiling?

Compiling is a process of translating a program file into machine-readable language.

Using the practice file, practice copying and pasting the text to rearrange the order of the lines.

Copy lines of text and paste in random locations.

When you started the vi editor, you forgot to specify the name for the new file you are creating. To save steps next time, how can you specify the name of a new file when you first start vi?

Enter vi and the filename, such as vi myfile.

How can you get help for using the vi editor? (Choose all that apply.)

From command mode enter :help. and d. From the regular command line outside of vi enter man vi.

You are using the vi editor to create a list of tasks on each line and you would like an easy way to number each line (task) listed in the file. Which of the following is an easy solution?

From command mode enter :set number.

You have been working on a long vi text file and now you've got to rush off to a meeting. How can you quickly save your work and exit the vi editor? (Choose all that apply.)

From command mode enter :wq.,b. From the command mode enter :ZZ.,, and d. From the command mode enter :x.

You are in the vi editor and it's now noon. Everyday at noon you run a program called update, which updates a database. How can you run the program without closing your vi session?

From command mode type :!update and press Enter..

While editing a file in vi you realize that you have been spelling the word receive as recieve. How can you find all occurrences of your misspelled receive? (Choose all that apply.))

From command mode, type /recieve and press Enter.

You're editing a document using vi and you are near the end of a page. You want to quickly go back to the top of the page to check something you said. Which of the following command-line commands enables you to quickly go to the top of the page?

H

As you look over the shoulder of an employee who is using the vi editor, you see her use the command :l,$s/capitol/capital. What does this command do?

It changes all instances of capitol to capital.

Paste the line with your first and last name in the middle of the text.

Move the cursor to the middle line in the file and type p to paste the line.

How can you find out information about the status of an editing session while in the vi editor? (Choose all that apply.)

Press Ctrl+g while in command mode.

Remove the eighth line, and place it at the end of the file.

Press Esc to return to Command mode and type 8G to move to the beginning of line eight. Type D to delete from the cursor to the end of the line. Type L to move to the last line. If necessary, type $ to move to the end of the current line. Type p to restore the deleted line to the end of the file.

Which of the following enables you to move the cursor to the left while you are in command mode in the vi editor? (Choose all that apply.)

Press the left arrow key. and c. Press h.

What is the name of a standardized bit pattern for characters and numbers that is used by most computer operating systems?

The name is American Standard Code for Information Interchange (ASCII).

How can you print a file while you are in the vi editor?

To print a file while in the vi editor type :lpr filename and press Enter.

Search for your last name.

Type /yourlastname and press Enter.

Move to the line of text that contains your first and last name, cut it, and place the text in the buffer.

Type 5G to move to line five (where you typed your first and last name), type dd to delete the current line and place it on the clipboard.

Go to the fifth line and insert your first and last name.

Type 5G to move to line five. Type i to switch to Insert mode. Type your first and last name.

Delete lines 9 and 10.

Type 9G to move to line nine. Type dd to delete the current line. Repeat the process for line 10.

Enter the command that causes line numbers to appear.

Type :set number and press Enter.

Save the file but do not exit vi.

Type :w and press Enter.

Without exiting vi, temporarily execute the ls command to confirm that the file is saved.

Type Ctrl+z to access the command prompt. Type ls and press Enter. Type fg and press Enter to return to vi.

Use the command to go to the first line of the file.

Type H.

Create a file with 12 lines of text. Delete the second word in the text.

Type vi 12linefile and press Enter. Type i to switch to Insert mode. Enter twelve lines of text. Press Esc to switch to Command mode. Type 1G to move to the beginning of the first line (be sure to use "G" and not "g"). Type w to move forward one word. Type dw to delete the current word.

Using the vi editor:Create a document called first.file, and enter a few lines of text in it. Save it.Create a second document called second.file, and enter a few lines of text in it. Save it.Create a third document called third.file by merging the text from the first two files.Save the third file, and exit the editor.Type vi third.file and press Enter to be certain third.file contains the text from both files.

Type vi first.file and press Enter. Type i to enter Insert mode. Enter a few lines of text then press Esc, type :x and press Enter to save and exit. Type vi second.file and press Enter. Type i to enter Insert mode. Enter a few lines of text then press Esc. Type :x and press Enter to save and exit. Type vi third.file and press Enter. In command mode type :r first.file and press Enter. Type :r second.file and press Enter. Type :x to save and exit.

Delete all text from third.file that you created using vi and then restore it.

Type vi third.file and press Enter. In command mode, type :d and press Enter. Repeat for each line of text. Type u to restore each individual line of text. Type :x and press Enter to save and exit.

Using the vi editor:Create a document with four lines each containing the word "today."Copy the first four lines using only one command.Save the file and exit vi.Reopen the document and change "today" to "yesterday" only on the first four lines.

Type vi todayfile and press Enter. Type i to enter Insert mode. Type line one today and press Enter. Type line two today and press Enter. Type line three today and press Enter. Type line four today and press Enter. Press Esc to return to "command" mode. Type . (period) to copy the four lines you entered. Type :x and press Enter to save the file and exit the editor. Type vi todayfile and press Enter to re-open the file. Make sure you are in "command" mode and type :1,4s/today/yesterday/g and press Enter. Type :x and press Enter to save and exit the editor.

Add text to the file, and practice using the cursor movement commands.

Use the cursor movement commands and insert new words throughout the file.

Your colleague has written a line of text in vi and now wants to delete the line, but save its contents in a buffer in case he decides to bring back the line he deletes. What do you recommend?

While in command mode, move the cursor to the first character in the line and press dd.

You are using vi to edit a file and have just entered 12 new lines. You need to replicate the same 12 lines right after you enter them. What command-mode command can you type to replicate the lines? (Choose all that apply.)

a period (.)

You are preparing to give a training session on the vi editor. How would you describe it? (Choose all that apply.)

a, It is modal., b. It is a text editor, c. Most UNIX/Linux distributions come with vi., and d. It is a screen editor.


Kaugnay na mga set ng pag-aaral

Chapter 2.8 Notes: Structuralism and Imperialism

View Set

Biology Chapter 10 Semester Exam Review Questions

View Set

AP Human Geography Chapter 8 Political Geography Notes

View Set

Prop & Casualty Insurance Basics

View Set

Chapter 07: Legal Dimensions of Nursing Practice (2)

View Set