- My Favorite Command Line Editors for Linux – What’s Your Editor?
- 1. Vi/Vim Editor
- Install Vi/Vim Editor in Linux
- 2. Nano Editor
- Install Nano Editor in Linux
- 3. Emacs Editor
- Install Emacs Editor in Linux
- Conclusion
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Linux line editor commands
- Vim editor cheat sheet
- Nano editor cheat sheet
- Share this information:
- Best Text Editors for Linux Command Line
- Classic Command Line Text Editors
- 1. Vim
- How to install it?
- 2. GNU Emacs
- How to install it?
- 3. Nano
- How to install it?
- Modern Text Editors For Command Line
- 4. ne – The Nice Editor
- How to install it?
- 5. Neovim
- How to install it?
- 6. Tilde
- How to install it?
- Wrapping Up
My Favorite Command Line Editors for Linux – What’s Your Editor?
Knowing how to fast and effectively edit files via command line is vital for every Linux system administrator. File edits are performed on a daily basis, whether it’s a configuration file, user file, text document or whatever file you need to edit.
This is why it is good idea to pick a favourite command line text editor and master it. It’s good to know how to work with other text editors, but you should master at least one so you can perform more complex tasks when needed.
In this tutorial, we are going to show you the most common command line text editors in Linux and show you their pros and cons.
Note however that we will not cover a complete guide how to work with each one of them as this can be a complete other article with explanation.
1. Vi/Vim Editor
First in our list is the infamous Vi/Vim (Vim comes from Vi improved). This is a very flexible text editor that can perform many different operations on text.
Vi/Vim Linux Editor
For example you can use regular expressions to replace text snippets in a file using vim. This of course is not the only benefit. Vi(m) provides an easy way to navigate between lines, words paragraphs. It also includes text highlighting.
Vim may not be the most user friendly text editor, but it is often preferred by developers and Linux power users. If you want to install this command line text editor on your system, you can use the command associated with your OS:
Install Vi/Vim Editor in Linux
If you want to see our complete coverage of vi(m), please follow the links below:
2. Nano Editor
Nano is probably one of the most used command line text editors. The reason for this is it’s simplicity and the fact that it’s preinstalled in most of the Linux distributions.
Nano Editor for Linux
Nano doesn’t have vim’s flexibility, but it will definitely do the work if you need to edit a large file. Actually pico and nano are quite similar. Both have their command options displayed at the bottom so you can choose which one to run. Commands are completed with key combinations of Ctrl and a letter displayed at the bottom.
Nano has the following features that you can use out of the box:
- Get Help
- Write out
- Justify
- Read File
- Where is (search)
- Previous page
- Next page
- Cut Text
- Uncut Text
- Cur Pos (Current position)
- Spell check
Install Nano Editor in Linux
You can check our complete guide for editing files with Nano editor on this link:
3. Emacs Editor
This is probably the most complex text editor in our list. It’s the oldest command line editor available for both Linux and UNIX based systems. Emacs can help you be more productive by providing an integrated environment for different kinds of tasks.
Emacs Editor for Linux
At first the user interface may look somehow confusing. The good thing is that emacs has a very detailed manual that will help you with file navigation, edits, customization, setting up commands. Emacs is the ultimate tool used by advanced *Nix users.
Here are some of the features that make it the preferred choice over the previous editors we mentioned:
- Emacs server platform enables multiple hosts to connect to the same Emacs server and share the buffer list.
- Powerful and extensible file manager.
- Customization beyond a regular editor – as some say it’s an OS within the OS.
- Commands customization.
- Can change to Vi(m) like mode.
Emacs is a multi-platform editor and can be easily installed with the commands shown below:
Install Emacs Editor in Linux
Note: In Linux Mint 17 I had to run the following command to complete the installation:
Conclusion
There are other command line editors, but they barely even reach the functionality that the above 3 provide. Whether you are a Linux newbie or a Linux guru, you will most definitely need to learn at least one of the above mentioned editors. If we’ve missed any command-line editor in this article, please don’t forget to inform us via comments.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
Linux line editor commands
Authored by: John Abercrombie
There are two command-line text editors in Linux®: vim and nano.
You can use one of these two available options should you ever need to write a script, edit a configuration file, create a virtual host, or jot down a quick note for yourself. These are but a few examples of what you can do with these tools.
While these tools might seem daunting at first, any Linux user should become accustomed to using at least one. Ask any Linux Administrator or regular user, and you soon find that everyone has their favorite.
This article covers the basics of each editing tool and how they differ.
Vim comes from Vi Improved because it is the successor of an older editor called vi. Because this editor (through its predecessor) has been around a long time, Linux Administrators or coders usually favor it. Vim is typically used by people who are familiar with Linux because it can have a bit of an uphill learning curve.
You can use vim to edit, write, and save a document from the command line. It does this through the use of two different modes:
By default, the vim editor opens in command mode. To open the vim editor, use the following syntax at the command line:
To start writing or editing, you must enter insert mode by pressing the letter i on your keyboard (“I” for insert). You should see —INSERT— at the bottom of your terminal page if you did it correctly.
When you are finished typing, and you want to save your work, you need to exit insert mode. Press the escape (esc) key, which places you back in command mode. Then you can save your work.
After you press escape, press shift + ;. The bottom of your terminal screen changes to reflect that you did it correctly. You now see a : where the —INSERT— was.
After you see the : in the lower left-hand corner of your vim editor, type w and then press enter to save your work. Then, you can either type i again to go back into insert mode if you want to continue writing, or you can quit the file. To quit, press shift + ; again, type q and then press enter. This saves your file and closes vim. You should see your usual terminal screen again.
You can also enter both the save and quit functions at the same time. To save and quit vim in one command, type wq after the : and then press enter. The file saves and closes.
If you start working on a file, but you change your mind, you can exit without saving. To do 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 the force function.
Those commands are the ones that you are going use most of the time, but you can use the following cheat sheet if you want to do more complex actions with vim.
Vim editor cheat sheet
Use the following commands in command mode:
- h — Moves the cursor to the left by one character; you can also press the left arrow.
- j — Moves the cursor one line down; you can also press the down arrow.
- k — Moves the cursor one line up; you can also press the up arrow.
- l — Moves the cursor to the right by one character; you can also press the right arrow.
- w — Moves the cursor one full word to the right.
- b — Moves the cursor one full word to the left.
- 0 — Moves the cursor to the beginning of the current line.
- $ — Moves the cursor to the end of the current line.
— Changes the case of the current character.
The following commands place you into insert mode:
- i — Inserts to the left of the current cursor position.
- a — Appends to the right of the current cursor position.
- dw — Deletes the current word.
- cw — Changes the current word.
Nano is 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:
After the nano editor opens, you can begin typing. When you’re ready to save your work, press ctrl + o, which is called a write out. It saves your current work while allowing you to continue your work. If you’re done, you can save and quit by pressing ctrl + x. When you save a file in nano, your current work is color-coded based on what you’re writing.
Another major difference with nano is that you can access a list of commands within the editor, but you can use the following cheat sheet as well.
Nano editor cheat sheet
Note: The commands in the following list use ^ to indicate that you should press the ctrl key along with the other key. For example ^G means that you should press ctrl + G.
- ^G — Get Help.
- ^X — Exit. Nano then asks if you want to save with a Y or N option.
- ^O — Write Out; also known as save.
- ^R — Read File. Enter the name of a file you want to paste into the current 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.
- ^_ — Go to line.
You can use the man pages to find out more in-depth information about each text editor. The commands are ‘man vim’ or ‘man nano’, respectively.
Share this information:
©2020 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License
Источник
Best Text Editors for Linux Command Line
Last updated July 20, 2020 By Munif Tanjim 21 Comments
A text editor is a must-have application for any operating system. We have no dearth of the best modern editors for Linux. But those are GUI based editors.
But, for a lot of good reasons, you still need to utilize the command-line. Not just for System Administrators but for the average user as well. Hence, text editors tailored for the terminal is definitely something important.
Here, I’ll compile a list of the best command line text editors for Linux.
Classic Command Line Text Editors
These are some of the most commonly-used and powerful command-line text editors for Linux.
1. Vim
If you’re on Linux for quite some time, you must have heard about Vim. Vim is an extensively configurable, cross-platform, and a highly efficient text editor.
It may not be suitable for newbies but it’s something every aspiring Linux System administrator should get comfortable with. You will probably find it pre-installed in your Linux distribution. It is extremely popular for its wide range of advanced features.
Vim can be quite agonizing for first-time users. I remember the first time I tried to edit a text file with Vim, I was completely puzzled. I couldn’t type a single letter on it and the funny part is, I couldn’t even figure out how to close this thing. If you are going to use Vim, you have to be determined for climbing up a very steep learning curve.
But after you have gone through all that, combed through its official documentation, and practice the commands/operations, you’ll find it worth all the time spent. Not to forget, you can use it for basic text editing or leverage its support for hundreds of programming languages, extensions and file formats.
How to install it?
If you don’t have it installed already, you can just try typing in the command (on Debian-based systems) to install it:
You can also find it listed in your software center of the Linux distribution you use. In either case, just head on to its official download page to get more details.
2. GNU Emacs
GNU Emacs is undoubtedly one of the oldest and versatile text editor out there. In case you didn’t know, it was created by GNU Project founder Richard Stallman.
Emacs is cross-platform and has both command-line and a graphical user interface. It is also very rich with various features and, most importantly, extensible.
Just as Vim, Emacs too comes with a steep learning curve. But once you master it, you can completely leverage its power. Emacs can handle just about any types of text files. The interface is customizable to suit your workflow. It supports macro recording and shortcuts as well.
The unique power of Emacs is that it can be transformed into something completely different from a text editor. There is a large collection of modules that can transform the application for using in completely different scenarios, like — calendar, news reader, word processor etc. You can even play games in Emacs!
How to install it?
You should find it in your software center or if you prefer using the terminal on Ubuntu-based distros, you can type in:
You can find more information on it in their official download page. Once you’re done installing, you need to type in a specific command to launch emacs in your terminal, which is:
Basically, this command instructs to not include any window to launch the program but the terminal itself.
3. Nano
When it comes to simplicity, Nano is the one. Unlike Vim or Emacs, it is suitable for beginners to get used to quickly.
If you want to simply create & edit a text file, look no further.
The shortcuts available on Nano are displayed at the bottom of the user interface. It is minimal and perfectly suitable for editing system & configuration files. For those who don’t need advanced features from a command-line text editor, Nano is the perfect pick.
If interested, you can learn how to use Nano text editor in our beginner’s guide.
How to install it?
For the most part, Nano editor should come in pre-installed on Ubuntu-based distributions. If it isn’t there, you can simply visit the official download page to get the binaries for the distribution you want.
Modern Text Editors For Command Line
Here, I shall list some terminal-based text editors that bring something new to the table or focus on making things easier.
4. ne – The Nice Editor
When compared to the classic and popular text editors, ne (the nice editor) is a good alternative which tries to offer advanced functionalities and making it easier to use them.
In other words, it’s a simpler alternative to Vim/Emacs offering you powerful features. It is being actively maintained — but not as regular as you’d expect. However, I tried it installing on Pop OS 20.04 and it worked just fine. You can explore more about it in their GitHub page.
Of course, unless you test it extensively, you should take it with a pinch of salt.
How to install it?
You should find it available in the official repositories of your Linux distribution. For Ubuntu-based distros, you can install it using the command:
You can also check out their official download page for more information on other Linux distributions.
5. Neovim
Neovim is a fork of Vim that aims to add more extensibility while simplifying it. If you’re comfortable with Vim, you will be good to go using Neovim.
The project is being actively maintained and the progress is promising so far. Of course, unless you’re acquainted with how Vim works, you may not notice the striking difference between the two.
But, overall, Neovim tries to take Vim up a notch.
How to install it?
For Ubuntu-based distros, you can simply install it by typing:
For other Linux distributions or platforms, you may refer to its official installation instructions to get started.
To give you a head start, I must mention that when using the terminal, you will have to type the following to launch it (instead of neovim):
6. Tilde
Tilde is a terminal-based text editor tailored for users who are normally used to GUI applications.
Unlike other options mentioned in this list — this may not be a power tool. But, for basic text editing operations, this is very easy to use. You do have some advanced functionality – but that’s not something to compare with Vim/Emacs.
If you wanted to try something easy-to-use and different, this is the one I’d recommend you to try.
How to install it?
For Ubuntu-based distros, you can simply type the following command in the terminal:
For information on other Linux distributions, you may refer to their GitHub page or the download page to explore more about it.
Wrapping Up
If you are an experienced Linux user, you must be aware of the popular options mentioned in this list.
Even though there are some good-old options like WordGrinder and JOE — I’m afraid that they are no longer actively maintained.
What do you think of the best command line text editors for Linux listed in this article? Did I miss any of your favorites? Let me know your thoughts in the comments below!
Like what you read? Please share it with others.
Источник