Lnux Flashcards
What command is used to open a file in Vim?
vim filename
True or False: In Vim, ‘i’ enters insert mode.
True
What command do you use to save changes in Vim?
:w
Fill in the blank: To exit Vim without saving, you use the command _____ .
:q!
What is the command for searching text in Vim?
/searchterm
What command allows you to undo the last change in Vim?
u
What command is used to redo changes in Vim?
Ctrl + r
How do you delete a line in Vim?
dd
What is the command to copy a line in Vim?
yy
True or False: The command ‘p’ pastes text after the cursor in Vim.
True
What does the command ‘:set nu’ do in Vim?
It shows line numbers.
What mode do you enter to edit text in Vim?
Insert mode
What key do you press to return to normal mode from insert mode?
Esc
How do you search and replace a word in Vim?
:s/oldword/newword/g
What command is used to split the window horizontally in Vim?
:split
What is the command to switch between open windows in Vim?
Ctrl + w, w
How do you move the cursor to the beginning of the line in Vim?
0
What command is used to save and exit Vim at the same time?
:wq
True or False: You can use ‘gg’ to go to the top of the file in Vim.
True
What command allows you to visually select text in Vim?
v
What is the command to change a word in Vim?
cw
What does ‘zz’ do in Vim?
It centers the current line in the window.
How do you navigate to the end of the file in Vim?
G
What key combination allows you to delete a word in Vim?
dw