Vim Editor Commands Quiz
30 Questions
17 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What command in Vim editor moves the cursor to the top of the page?

  • M (correct)
  • G
  • $
  • L

In Vim editor, which command moves the cursor to the end of a line?

  • $ (correct)
  • L
  • H
  • M

Which command in Vim editor scrolls back one page?

  • CTRL + b (correct)
  • CTRL + f
  • CTRL + d
  • CTRL + u

What command in Vim editor moves the cursor to the beginning of the next sentence?

<p>) (C)</p> Signup and view all the answers

Which command in Vim editor moves the cursor one word at a time?

<p>$ (D)</p> Signup and view all the answers

In Vim editor, what command moves the cursor back a word at a time?

<p>B (D)</p> Signup and view all the answers

How can a user toggle back to the command mode from the last line mode in Vim editor?

<p>By pressing the ESC key twice (A)</p> Signup and view all the answers

What is the correct method to create a file in Vim editor?

<p>Type vi followed by a file name and press Enter key (C)</p> Signup and view all the answers

Which command is used to enter insert mode in Vim editor?

<p>None of the above (D)</p> Signup and view all the answers

How can a file be saved in Vim editor?

<p>:wq (A)</p> Signup and view all the answers

Which key is pressed twice to toggle back to the command mode from the last line mode in Vim editor?

<p>[Delete] (D)</p> Signup and view all the answers

What happens when 'vi' is typed without a file name in Vim editor?

<p>'vi' command opens a new unsaved buffer for editing (D)</p> Signup and view all the answers

To execute Linux commands from within the Vim editor, what symbol should be typed before the command?

<p>! (exclamation) (A)</p> Signup and view all the answers

What is the purpose of a shell script in Linux?

<p>To execute a set of commands in a controlled order (A)</p> Signup and view all the answers

Which of the following is NOT a common element in a shell script?

<p>Blocks (D)</p> Signup and view all the answers

In Linux, what is a good practice regarding file extensions for shell scripts?

<p>It is good practice to use .sh extension (C)</p> Signup and view all the answers

What distinguishes a shell script from single Linux commands?

<p>A shell script is a set of commands written in plain text file that performs a designated task in a controlled order (D)</p> Signup and view all the answers

What is the main benefit of using shell scripts in Linux?

<p>To make system operations more efficient by automating tasks (D)</p> Signup and view all the answers

What symbol signifies the beginning of a comment in Ubuntu Linux?

<h1>(A)</h1> Signup and view all the answers

What type of elements in a script are not executed but provide understanding to users?

<p>Comment (C)</p> Signup and view all the answers

Which command clears the screen contents before displaying the output of a script?

<p>Clear (A)</p> Signup and view all the answers

Which command is used to display a message on the screen?

<p>Echo (A)</p> Signup and view all the answers

What command provides the name and additional details of the currently logged-in user?

<p>who am i (A)</p> Signup and view all the answers

Which command is used to execute a script using 'sh' or 'bash' command?

<p>Both (a) and (b) (D)</p> Signup and view all the answers

Should there be a space before and after the assignment operator (=) when writing a numerical expression in Linux?

<p>No (C)</p> Signup and view all the answers

In Linux, which operator is used for addition?

<ul> <li>(C)</li> </ul> Signup and view all the answers

Which operator is used for subtraction in Linux?

<ul> <li>(A)</li> </ul> Signup and view all the answers

What operator is used for multiplication in Linux?

<p>** (C)</p> Signup and view all the answers

Which operator is used for division in Linux?

<p>/ (C)</p> Signup and view all the answers

What happens if there is a tie between operators of the same priority in a numerical expression?

<p>First one is executed (C)</p> Signup and view all the answers

Flashcards

ESC Key (Twice)

A keypress that switches from Vim's last line mode back to command mode.

Colon (:) in Vim

A special character that marks the beginning of the last line in Vim editor, signaling you're in command mode.

Insert Mode in Vim

The primary mode in Vim for editing text.

Shell Script

A text file containing a sequence of commands that can be executed by a shell interpreter.

Signup and view all the flashcards

Saving in Vim

The command used to save a file in Vim editor.

Signup and view all the flashcards

Exclamation Mark (!) in Vim

A symbol used to execute Linux commands from within the Vim editor.

Signup and view all the flashcards

Clear Command

The command used to clear the screen contents before displaying the script's output.

Signup and view all the flashcards

Hash (#) in Ubuntu

A symbol that designates a comment in Ubuntu Linux.

Signup and view all the flashcards

Who Am I Command

A command that displays user information, such as their name and login details.

Signup and view all the flashcards

Addition Operator (+)

The '+' operator is used to perform addition.

Signup and view all the flashcards

Subtraction Operator (-)

The '-' operator is used to perform subtraction.

Signup and view all the flashcards

Multiplication Operator (*)

The '*' operator is used to perform multiplication.

Signup and view all the flashcards

Division Operator (/)

The '/' operator is used to perform division.

Signup and view all the flashcards

Modulus Operator (%)

The '%' operator is used to find the remainder of a division operation.

Signup and view all the flashcards

Numerical Expressions in Linux

Expressions that use operators to perform arithmetic operations.

Signup and view all the flashcards

Chmod Command

A command used to set file permissions.

Signup and view all the flashcards

File Executability

Making a file executable so it can be run as a program.

Signup and view all the flashcards

Screen Commands

Commands that control the display of information on the terminal.

Signup and view all the flashcards

Echo Command

A command used to display a message on the screen.

Signup and view all the flashcards

Executing a Shell Script

A command used to execute a shell script.

Signup and view all the flashcards

Creating a File in Vim

The command used to create a file in Vim editor.

Signup and view all the flashcards

Moving to the Next Sentence in Vim

A command used to move the cursor to the beginning of the next sentence in Vim editor.

Signup and view all the flashcards

Moving to the Current Sentence in Vim

A command used to move the cursor to the beginning of the current sentence in Vim editor.

Signup and view all the flashcards

Scrollin Back One Page in Vim

A command used to scroll back one page in Vim editor.

Signup and view all the flashcards

Moving to the Middle of the Page in Vim

A command used to move the cursor to the middle of the page in Vim editor.

Signup and view all the flashcards

Moving to the End of the File in Vim

A command used to move the cursor to the end of the file in Vim editor.

Signup and view all the flashcards

Moving to the End of the Line in Vim

A command used to move the cursor to the end of the line in Vim editor.

Signup and view all the flashcards

Moving One Word at a Time in Vim

A command used to move the cursor one word at a time in Vim editor.

Signup and view all the flashcards

Moving Back a Word at a Time in Vim

A command used to move the cursor back a word at a time in Vim editor.

Signup and view all the flashcards

Moving to the Top of the Page in Vim

A command used to move the cursor to the top of the page in Vim editor.

Signup and view all the flashcards

Moving to the Bottom of the Page in Vim

A command used to move the cursor to the bottom of the page in Vim editor.

Signup and view all the flashcards

Study Notes

Vim Editor

  • In the Vim editor, a colon character is seen at the beginning of the last line of the window with the cursor blinking near it.
  • Pressing the ESC key twice toggles back to command mode from the last line mode.

Creating a File in Vim Editor

  • A file can be created in Vim editor by typing "vi" followed by a file name and pressing Enter, or by simply typing "vi" and pressing Enter.
  • The commands used to create a file in Vim editor are both "vi filename" and "vi".

Insert Mode

  • The commands used to enter insert mode are both "a" and "i".

Saving a File

  • The command used to save a file in Vim editor is ":s/phrasel/phrase2".

Executing Linux Commands in Vim Editor

  • To execute Linux commands from within the Vim editor, type an exclamation mark (!) before the command.

Shell Scripts

  • A shell script is a set of commands written in plain text that performs a designated task in a controlled order.
  • It is not necessary to provide a ".sh" extension to a shell script, but it is a good practice to do so.

Operators in Linux

  • The operators used for basic arithmetic operations in Linux are:
    • Addition: +
    • Subtraction: -
    • Multiplication: *
    • Division: /
    • Modulus (remainder): %

Numerical Expressions in Linux

  • Numerical expressions in Linux are evaluated according to the general norms of mathematics.
  • In case of a tie between operators of the same priority, preference is given to the operator that occurs first.
  • To force one operation to be performed earlier than another, the operation can be enclosed in parentheses.

Vim Editor Navigation

  • The commands used to navigate in Vim editor are:
    • CTRL + b: scrolls back one page
    • M: moves the cursor to the middle of the page
    • H: moves the cursor to the top of the page
    • L: moves the cursor to the bottom of the page
    • $: moves the cursor to the end of the line
    • ): moves the cursor to the beginning of the next sentence
    • (: moves the cursor to the beginning of the current sentence
    • G: moves the cursor to the end of the file
    • W: moves the cursor one word at a time
    • B: moves the cursor back a word at a time

Comments in Ubuntu Linux

  • A comment in Ubuntu Linux begins with the symbol #.
  • Comments are not executed; they are messages that help users understand the usage or meaning of the script.

Screen Commands

  • The command used to clear the screen contents before giving the output of the script is "clear".
  • The command used to display a message on the screen is "echo".

User Information

  • The command used to display the name and some additional details of the user currently logged into the system is "who am i".

Executing Scripts

  • The commands used to execute a script are both "sh" and "bash".
  • The command used to set the desired privileges is "chmod".
  • The command used to make a file executable is "chmod +x filename".

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge of Vim editor commands and shortcuts with this quiz. See if you can identify which key to press twice to toggle back to the command mode. Identify common prompts and characters in Vim editor windows.

More Like This

Vim Editor Modes
10 questions

Vim Editor Modes

RationalClearQuartz avatar
RationalClearQuartz
Vim Editor History and Features
10 questions
Vim Configuration File Tutorial
20 questions
Vim Editor: Features and Usage
10 questions
Use Quizgecko on...
Browser
Browser