linux command line text editor

linux command line text editor

Here we can see, “linux command line text editor”

What is a Text Editor in Linux?

A text editor also referred to as a code editor, is an application designed for coding and editing in HTML, CSS, JavaScript, PHP, and many other programming languages. Most editors accompany features like Syntax highlighting, easy navigation, customizable interfaces, search and replace options, and so on.

In Linux, there are two sorts of text editors:

  • Command-line text editors. A simple example is Vim, which allows you to jump into the editor from the instruction. System admins will find this very useful when editing configuration files.
  • Graphical interface (GUI) text editors. This sort of text editor features a GUI but can’t be used from the instruction.

There are two command-line text editors in Linux®: Vim and nano.

You can use one of these two available options. Do you ever have to write a script, edit a configuration file, create a virtual host, or jot a quick note for yourself? These are but a couple of samples of what you’ll do with these tools.

While these tools might sound daunting initially, any Linux user should become familiar with using a minimum of one. Ask any Linux Administrator or regular user, and you soon find that everybody has their favourite.

This article covers the fundamentals of every editing tool and the way they differ.


Vim comes from Vi Improved because it’s the successor of an older editor called vi. Because this editor (through its predecessor) has been around an extended time, Linux Administrators or coders usually favour it. Vim is usually employed by people who are conversant in Linux because it can have an uphill learning curve.

You can use Vim to edit, write, and save a document from the instruction. It does this through the utilization of two different modes:

  • Command
  • Insert

By default, the vim editor opens in command mode. To open the vim editor, use the following syntax at the command line:

$ vim (name of the file)


$ vim (full path of the file)

To start writing or editing, you want to enter insert mode by pressing the letter i on your keyboard (“I” for insert). You ought to see —INSERT— at rock bottom of your terminal page if you probably did it correctly.

When you are finished typing and want to save lots of your work, you would like to exit insert mode. Press the escape (ESC) key, which places you back in command mode. Then you’ll save your work.

After you press escape, press shift +; rock bottom of your terminal screen changes to reflect that you did it correctly, you now see a: where the —INSERT— was.

Also See:  Halo Infinite's Banished Villain Escharum Stars In Trailer

After you see the: within the lower left-hand corner of your vim editor, type w then press enter to save lots of your work. Then, you’ll type I again to travel back to insert mode if you would like to continue writing. Otherwise, you can quit the File. To quit, press shift +; again, type q, then press enter. This protects your File and closes Vim. Finally, you ought to see your usual terminal screen again.

You can also enter both the save and quit functions at an equivalent time. to save lots of and quit Vim in one command, type wq after the: then press enter. The File saves and closes.

If you begin performing on a file but you modify your mind, you’ll exit without saving. to try to to this, enter command mode by pressing ESC followed by shift +; After you see the: at the lower left, enter q!. This force-quits Vim without saving. ! is that the force function.

Those commands are those that you simply are going to use most of the time, but you’ll use the subsequent cheat sheet if you would like to try to to more complex actions with Vim.

Vim editor cheat sheet

Use the subsequent commands in command mode:

  • h – Moves the cursor to the left by one character; you’ll also press the left arrow.
  • J – Moves the cursor one line down; you’ll also press the down arrow.
  • k – Moves the cursor one line up; you’ll also press the up arrow.
  • l – Moves the cursor to the proper by one character; you’ll also press the proper arrow.
  • w – Moves the cursor one full word to the proper.
  • b – Moves the cursor one full word to the left.
  • 0 – Moves the cursor to the start of the present line.
  • $ – Moves the cursor to the top of the present line.
  • ~ – Changes the case of the present character.
  • dd – Deletes the current line.
  • D – Deletes everything on the road to the proper of the cursor’s current position.
  • X – Deletes the present character.
  • u – Undo the last command.
  • . – Repeats the last command.
  • :w – Saves current File but doesn’t exist.
  • :wq – Saves current File and quits.

The following commands place you into insert mode:

  • i – Inserts to the left of the present cursor position.
  • a – Appends to the proper of the present cursor position.
  • dw – Deletes the present word.
  • cw – Changes the present word.


Nano may be a newer text editor in Linux systems. It’s simpler and easier to use than Vim.

To open a file with nano, use the following syntax at the command line:

$ nano (name of the file)


$ nano (full path of the file)

After the nano editor opens, you’ll begin typing when you’re able to save your work, press ctrl + o, which is named a write out. It saves your current work while allowing you to continue your work. If you’re done, you’ll save and quit by pressing ctrl + x. once you save an enter nano, your current work is colour-coded, supported by what you’re writing.

Another major difference with nano is that you can access an inventory of commands within the editor, but you’ll also use the subsequent cheat sheet.

Nano editor cheat sheet

Note: The commands within the following list use ^ to the point that you simply should press the Ctrl key alongside the opposite key. For instance, ^G means you ought to press ctrl + G.

  • ^G – Get Help.
  • ^X – Exit. Nano then asks if you would like to save lots with a Y or N option.
  • ^O – Write Out; also referred to as save.
  • ^R – Read File. Enter the name of a file you would like to stick into the present document at your cursor’s position.
  • ^W – Where Is; Search function.
  • ^\ – Replace.
  • ^K – Cut text.
  • ^U – Uncut text.
  • ^J – Justify.
  • ^T – To spell.
  • ^C – Current Position; Cancel Save.
  • ^_ – attend line.

linux command line text editor with syntax highlighting

Syntax highlighting may be a simple but useful component in most text editors used for programming, scripting, or markup languages, which enables displaying coloured text, notably ASCII text files, in several colours (and possibly fonts) like the category of terms.

VIM is an alternate and advanced version of VI editor that permits Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in other fonts and colours. VIM doesn’t show the whole File but has limitations in highlighting particular keywords or text matching a pattern during a file. By default, VIM works on all Linux terminals, but some have minimal highlighting capabilities to run.

VIM has another great feature that enable us to show Off or activate Syntax highlighting using option syntax on and Syntax off.

Also See:  Report claims Google is abandoning Qualcomm modem chipset for the Pixel 6

How to Install VIM

Most Linux systems already included the VIM package; if not, then install it using the YUM tool.

# yum -y install vim-enhanced

How to Enable Syntax Highlighting in VI and VIM

To enable the Syntax Highlighting feature in VI editor, open the File called /etc/profile.

# vi /etc/profile

Add the alias function to VI by pointing to VIM in the/etc/profile file. This File is employed to line alias functions globally.

alias vi=vim

If you wish to set user-specific aliases and functions, you would like to open the File .bashrc under the user directory.

# vi /home/tecmint/.bashrc

Add the alias function. For instance, we set an alias for the tecmint user.

alias vi=vim

After making the file changes, you would like to reset the changes by executing the following command.

# source /etc/profile
# source /home/tecmint/.bashrc

Test Syntax Highlighting in Vi Editor

Open any example code of File with vi editors. By default, Syntax Highlighting is automatically turned on in the/etc/vimrc File.

Turn On or Turn Off Syntax Highlighting in VI

You can activate or close up Syntax highlighting by pressing the ESC button and use the command: Syntax on and: Syntax off in Vi editor.

Turn on color syntax highlighting in vim

Open a file, for instance open existing file called file.c, enter:

$ vi file.c

Now press ESC key, type “: syntax on” i.e. type as follows:

:syntax on

Turn off color syntax highlighting in vim

To turn it backtrack, press the ESC key, type: Syntax off

:syntax off

How do I make the syntax highlighting permanent under vim?

You can edit the ~/.vimrc file and add append vim command syntax to that. This ensures that Vim will start with a colour syntax highlighting option:

$ cd ~
$ vi .vimrc

Append the subsequent line:

syntax on

Save and shut the File. You ought to now be ready to use Vim to edit files with Syntax on options.

How to set and use a vim color scheme

You can find installed color schemes in the following path:


Use the ls command to list it:

$ ls -l /usr/share/vim/vim*/colors/

best linux command line text editor

Sublime Text

What makes Sublime Text stand out is its ability to form use of every OS’ native functionalities. That creates Sublime Text one among the more resource-efficient options.

How to Install

Sublime Text isn’t a default application on most Linux installations. Install it with the subsequent command:

wget -qO - | sudo apt-key add -
echo "deb apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install sublime-text


Atom may be a popular open-source code/text editor that works across several Windows, Mac, or Linux platforms. Atom is additionally considered to be one of the simplest Python code editors.

How to Install

Atom isn’t typically included during a default Linux installation. Install it with the subsequent commands:

sudo add-apt-repository ppa:webupd8team/atom
sudo apt-get update
sudo apt-get install atom

For RedHat or CentOS systems, use the yum install command rather than apt-get install.

Visual Studio Code

If you’ve installed Anaconda on Linux, you’ll be conversant in the choice to put in Microsoft Visual Studio Code. Albeit it’s from Microsoft, VSCode is cross-platform, meaning it works on Windows, Linux, and Mac.

How to Install

Install VSCode with the subsequent command:

sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt-get update
sudo apt-get install ubuntu-make

Bluefish Text Editor

The bluefish text editor is aimed toward making coding more accessible. It works on most platforms, so that you’ll use it on Linux, Mac, or Windows.

How to Install

Install Bluefish by executing the subsequent command:

sudo add-apt-repository ppa:klaus-vormweg/bluefish
sudo apt-get update
sudo apt-get install bluefish


Geany works as a text editor, but its primary function is an Integrated Desktop Environment (IDE). It’s a lightweight GUI text editor with basic IDE features. Its primary purpose is to be tight and compact with short lead times and limited dependencies on separate packages or external libraries on Linux.

Also See:  Animal Crossing Update is Removing Items From Players' Islands

How to Install

Install Geany with the subsequent command:

sudo apt-get update
sudo apt-get install geany

linux mint command line text editor


When working during a GNOME desktop distribution, Gedit comes loaded into your system by default and maybe a core application of the GNOME desktop. Gedit is meant as a general-purpose text editor, providing clean and easy functionalities. Consistent with GNOME objectives, Gedit emphasizes simple use and ease with a clean and straightforward Graphical interface (GUI). The Gedit text editor was first introduced in 2000, alongside the GNOME desktop. Gedit was developed within the C programing language and supported internationalized text.

$ sudo apt install gedit     [On Debian, Ubuntu, and Mint]
$ sudo dnf install gedit     [On RHEL, CentOS and Fedora]
$ sudo pacman -S gedit       [On Arch Linux and Manjaro]
$ sudo zypper install gedit  [On OpenSuse]


The Bracket text editor was launched in 2014 by Adobe for the Linux environment. The Bracket is open-source and comes with a bundle of exciting features. The Bracket text editor is extremely simple and easy to use, with a clean interface. This program was developed using CSS, HTML, and JavaScript. This text editor is specially designed for dual purposes, acting as both a text editor and a code editor to assist programmers and web designers in their work. The Bracket is lightweight and relatively better than other text editors, thanks to several advanced features. The unique features of Bracket include live preview, inline editing, and support for pre-processor and visual tools. to urge Bracket in Linux Mint 20, execute the subsequent commands within the terminal:

sudo add-apt-repository ppa:webupd8team/brackets
$ sudo apt-get updatesudo apt-get install brackets


The Nano text editor is employed in UNIX-like operating systems. Nano was first released in 2000 and is just like the Pico text editor. Nano offers some more advanced functionalities that make this program a strong text editor. This text editor can only run during a command-line interface. Nano has important features, including case sensitive searches, tab completion, auto-indentation, and Autoconf support.

$ sudo apt install nano     [On Debian, Ubuntu, and Mint]
$ sudo dnf install nano     [On RHEL, CentOS and Fedora]
$ sudo pacman -S nano       [On Arch Linux and Manjaro]
$ sudo zypper install nano  [On OpenSuse]

User Questions:

1.How does one use a text editor in Linux?

To start writing or editing, you want to enter insert mode by pressing the letter i on your keyboard (“I” for insert). You ought to see —INSERT— at rock bottom of your terminal page if you probably did it correctly. Once you are finished typing and would like to save lots of your work, you would like to exit insert mode.

2.What text editor should I exploit for Linux?

Microsoft’s VS code is far and away from the simplest text editor for Linux. However, it’s also the foremost popular choice because it has an excellent UI and overall features. A number of the opposite best text editors for Linux are Atom and Vim.

3.What text editor do professionals use?

Many web professionals get their start with Notepad, the text editor that’s included with Windows. This is sensible because Windows may be a popular OS, and therefore the included text editor is straightforward to access. If you’re comfortable with Notepad, but you’re able to step things up a touch, you would possibly enjoy Notepad++

Also See:  How to: Fix Skype Problem With Playback Device in Windows 10

4.Command line text editor (Vim) or GUI text editor (Sublime)

Command line text editor (Vim) or GUI text editor (Sublime) from bashonubuntuonwindows

5.How do I become more efficient at editing text files via the command line?

How do I become more efficient at editing text files via command line? from commandline