Vim Editor Commands Quiz
30 Questions
8 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>)</p> Signup and view all the answers

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

    <p>$</p> Signup and view all the answers

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

    <p>B</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</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</p> Signup and view all the answers

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

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

    How can a file be saved in Vim editor?

    <p>:wq</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]</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</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)</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</p> Signup and view all the answers

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

    <p>Blocks</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</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</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</p> Signup and view all the answers

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

    <h1></h1> Signup and view all the answers

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

    <p>Comment</p> Signup and view all the answers

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

    <p>Clear</p> Signup and view all the answers

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

    <p>Echo</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</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)</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</p> Signup and view all the answers

    In Linux, which operator is used for addition?

    <ul> <li></li> </ul> Signup and view all the answers

    Which operator is used for subtraction in Linux?

    <ul> <li></li> </ul> Signup and view all the answers

    What operator is used for multiplication in Linux?

    <p>**</p> Signup and view all the answers

    Which operator is used for division in Linux?

    <p>/</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</p> Signup and view all the answers

    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 Editor: Features and Usage
    10 questions
    Vim Text Editing Commands Quiz
    28 questions
    Use Quizgecko on...
    Browser
    Browser