You cannot install Vim on Ubuntu without using the terminal

Vim is a text editor that lives in the terminal — it has no graphical installer and no point-and-click setup. Every installation method for Vim on Ubuntu requires you to type commands into the terminal at some point. If you want to edit code or configuration files on Ubuntu, you will need to open a terminal window and run at least one command.

The good news is that the terminal command to install Vim is short, straightforward, and takes less than a minute. You do not need to understand Linux deeply or memorize anything. This guide walks you through the exact steps, explains what each one does, and shows you what to expect when Vim opens for the first time.

Key Takeaways

  • Vim installs through the terminal using a single command: sudo apt install vim, which takes about 30 seconds.
  • The terminal is the only way to install Vim because Vim itself is a terminal-based editor with no graphical interface.
  • After installation, you launch Vim by typing vim filename.txt in the terminal to open and edit a file.
  • If you want a graphical text editor instead, Ubuntu comes with GNOME Text Editor or you can install VS Code through the Software Center without touching the terminal.

Opening the terminal on Ubuntu

The terminal is a window where you type commands instead of clicking buttons. On Ubuntu, you open it the same way you open any other program. Press the Super key (the Windows logo key on most keyboards) to open the Activities menu, then type the word "terminal" and press Enter. A black or dark gray window will appear.

You can also right-click on the desktop and look for an option like "Open in Terminal" or "Open Terminal Here" — this varies depending on your Ubuntu version and desktop environment. Once the terminal window is open, you are ready to type the installation command.

Running the installation command

In the terminal window, type this command exactly as shown:

sudo apt install vim

Then press Enter. The system will ask you to confirm by typing your password (the same password you use to log into Ubuntu). When you type the password, you will not see the letters appear on screen — this is normal and a security feature. Type your password and press Enter again.

The terminal will show a progress bar or text saying it is downloading and installing Vim. This usually takes 20 to 60 seconds depending on your internet speed. When it finishes, you will see a command prompt again (usually a dollar sign or hash mark). Vim is now installed.

Opening Vim for the first time

To open Vim and create or edit a file, type this command in the terminal:

vim myfile.txt

Replace "myfile.txt" with whatever you want to name your file. Press Enter, and Vim will open inside the terminal window. The screen will show the filename at the bottom and a column of tildes (~) down the left side, which means the file is empty.

Vim starts in "normal mode," where you navigate and give commands. To start typing, press the letter i (for "insert") and the bottom of the screen will show "-- INSERT --". Now you can type normally. When you are done, press the Escape key to return to normal mode, then type :wq (colon, w, q) and press Enter. This saves the file and closes Vim.

Why Vim requires the terminal

Vim was designed in the 1990s as a terminal-based editor for people working on remote servers or systems without graphical displays. It has no buttons, menus, or windows — everything happens through keyboard commands. This design makes Vim very fast and powerful for people who use it regularly, but it also means there is no way to install or run it outside the terminal.

If you find Vim confusing or want a more familiar experience, Ubuntu includes other text editors that work differently. GNOME Text Editor (called "Text Editor" in the applications menu) opens like any other program and works like Notepad. VS Code is a more powerful editor that you can install through the Software Center without typing any commands.

What to do if the installation fails

If you see an error message like "command not found" or "E: Unable to locate package vim," your system may not have its package list updated. Type this command first:

sudo apt update

Press Enter, wait for it to finish (this can take a minute or two), then try the Vim installation command again. If you see a message saying "vim is already the newest version," Vim is already installed and you can start using it when ready.

If you see a permission error or a message about sudo, you may not have administrator access on this computer. Ask the person who manages the system to install Vim for you, or check whether you are using a restricted account.

Alternatives if you do not want to use the terminal

If the terminal feels too unfamiliar and you want a graphical text editor, you have options. Open the Software Center (the app store icon in your dock or applications menu) and search for "VS Code" or "Visual Studio Code." Click Install and the system will handle everything without you typing any commands. VS Code is a full code editor with a graphical interface, syntax highlighting, and built-in help.

Ubuntu also comes with GNOME Text Editor pre-installed. Open the Activities menu, type "text editor," and it opens when ready. This is simpler than Vim and works like any text editor you have used before, but it does not have Vim's advanced features or keyboard shortcuts.

Frequently Asked Questions

Do I have to use Vim if I install it?

No. Installing Vim just makes it available. You can install it and never use it, or use it only when you need it. Many Ubuntu users install Vim but use other editors for daily work. You control which editor you use by choosing which command you type.

What if I get stuck inside Vim and cannot get out?

Press the Escape key, then type :q! (colon, q, exclamation mark) and press Enter. This closes Vim without saving. If you want to save before closing, use :wq instead. These are the two most important Vim commands to remember.

Can I edit files that already exist?

Yes. Type vim /path/to/filename where the path is the location of the file. For example, vim Documents/myfile.txt opens a file called myfile.txt in your Documents folder. Vim will load the existing content and let you edit it.

Is there a graphical version of Vim?

Yes, called GVim, but it is rarely used. Most people either use Vim in the terminal or switch to a different editor like VS Code. GVim adds a graphical window around Vim but keeps the same keyboard-based editing, so it does not solve the learning curve problem.

Why does Vim use strange key combinations like :wq?

Vim was designed when computer keyboards were different and people worked on slow connections where every keystroke mattered. The design prioritizes speed for experienced users. Modern editors like VS Code use familiar shortcuts like Ctrl+S to save, which is why many people find them easier to learn.