Linux Ch.4

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Use this command to move to the end of the current line. Use these commands to move to the beginning of the current line.

$ ^ or 0

Use this command to return to the previous cursor location.

'' (two single quotation marks)

Type this to delete one or multiple lines. Type this delete one or multiple characters. Type this to delete one or multiple words.

(#)dd (#)x d(#)w

Use this command to copy one or more lines. Use this command to copy one or more words.

(#)yy y(#)w

Use this command in command mode to search forward for all instances if a string in vi. Use this command to search backward through the file. Press this button to move to the next instance. Press this to reverse direction and go to the previous instance.

/(string) ?(string) n N

You just opened a file in vi and you want to search for a particular string called "printf". What can you type in vi to search for this string?

/printf

Use these commands to go to specific lines. Use these commands to go to the last line.

:# enter or #G :$ enter or G

Use this command to move a block of text to another part of the file. Use this command to copy a block of text and paste to another part of the file.

:#,# move (line number) :#,# copy (line number)

Use this command to write blocks of text to new files. Use this command to overwrite blocks of text to existing files. Use this command to append text to an existing file.

:#,# w (new file) :#,# w! (file) :#,# w >> (file)

Use this command to delete a line(s) based on its/their line number(s).

:#d :#, #d

Using vi or vim, the following command moves your cursor to line 57

:57

Use this command to read a file into editor.

:r (file)

Use this command to search for a word and then replace the first occurrence of that word with a different word. Use this command to search the whole file for a word and replace each occurrence of the word with a new word.

:s/(search for)/(replace with) :1,$ s/(search for)/(replace with)/g

Use this command to see what environmental features are currently set.

:set

Use this command to tell the editor to ignore case in a search.

:set ignorecase

Which set command creates line numbers in your vi file? Which set command removes the line numbers?

:set number :set nonumber

Use this command to save the file and quit the editor. Use this command to quit without saving. Use this command to save to a new file.

:wq :q! :w (new file)

Use this command to simultaneously delete the remainder of a line from the cursor and enter append mode to replace it with new text.. Use this command to simultaneously delete text from the right of the cursor to a specified character and enter append mode to add new text.

C cf(character)

This command scrolls down one-half screen of text in a file. This command scrolls up one-half screen of text in a file. This command displays the next screen of text in a file. This command displays the previous screen of text in a file.

CTRL-D CTRL-U CTRL-F CTRL-B

Use this command to delete the remainder of a line starting with the text under the cursor. Use this command to delete text from the right of the cursor to a specified character.

D df(character)

This command positions the cursor at the highest line on the screen. This command positions the cursor at the line closest to the midpoint on the screen. This command positions the cursor at the lowest line on the screen.

H M L

Use this command to append text at the beginning of a line. Use this command to append text at the end of a line.

I A

Use this command to join two lines of text.

J

You have a file called somefile and you just opened it using vi. After typing G and :1[ENTER] where is your cursor sitting (what line #)?

Line #1

The command :r somefile [assume the file is created]

Will read in the contents of somefile into the vi editor

Press these buttons to enter append mode. Press this button to return to command mode.

a or i esc

Use this command to simultaneously delete a word and go into append mode to replace it with any number of words. Use this command to simultaneously delete a line and go into append mode to replace it with any number of words.

cw cc

Use this command to delete text from the current position to the end of a bookmarked line. Use this command to delete text from the current position to the end of a bookmarked line and enter append mode to add new text. Use this command to copy text from the current position to the end of a bookmarked line.

d'(letter) c'(letter) y'(letter)

Use this command to move to the first instance of a specified character in a line. Use this command to move to a specific character position.

f(character) #|

There are three modes in vi: command, append/insert and print. T/F

false

Use this command to bookmark a line in the file. Use this command to return to the selected bookmark.

m(letter) '(letter)

Use this command to open a line below the cursor. This command opens a line above the cursor.

o O

Use this command to paste a copied selection below the line of the current cursor position. Use this command to paste a copied selection above the line of the current cursor position.

p P

Use this command to replace the single character under the cursor with another character. Use this command to type over text and replace it character by character. Use this command to substitute a single character with many characters.

r R s

The cat command can be used to create a file. T/F

true

Using the vi/vim editor, both [ESCAPE] shift-ZZ and :wq [ENTER] write and close the file. T/F

true

You can use the arrow keys and the keys, j, h, l, and k to move around in vi. T/F

true

Type this to undo a command.

u

Which command creates newfile in vi?

vi newfile

In command mode, use this command to move to the beginning of the next word. Use this command to move to the end of the next word. Use this command to move back to the previous word. Use these commands with numbers to move through several words at a time.

w e b #w, #e, #b

Use this command to copy text from the right of the cursor to a specified character.

yf(character)


संबंधित स्टडी सेट्स

My Christian Worldview Study Guide

View Set

(Book 3) Ch. 4 - Ownership Rights and Limitations

View Set

Biochem Chapter 2 Learning Objectives

View Set

Week 5: Two-Way ANOVA (independent measures)

View Set

ADN 140 - PrepU - Safe Practice 1

View Set

Calculs volumes et surfaces geometrie

View Set