how to reverse lines and characters in the buffer in emacs editor

emacs execute shell command

There are several different commands to sort text in the buffer. Reversing lines, words or even paragraphs is just a variation of sorting text. Reverse Lines in buffer The command to reverse text is reverse-region, and as the command indicates works on the current active region of the buffer. M-x reverse-region The reverse-region command will reverse the order of the…

how to create a new file or buffer in emacs editor

save buffers and exit emacs

If you have been using emacs as your text editor then one of the first things you probably want to know is how to create a new file or buffer in the editor. As with many of the modern editors, emacs has the concept of a buffer and a file. A buffer is the “object” that the editor holds on…

how to enable and disable toolbar, menubar, tabbar and scrollbar in emacs

emacs toolbar menubar tabbar scrollbar

Most emacs distributions, at least the ones I have seen come with the toolbar and the menubar enabled. More often than not, it is a distraction and a waste of space. Also if you were planning to learn emacs the emacs way, then these definitely are not helpful. You can hide or disable both the toolbar and menubar in the…

how to show line numbers in emacs editor

display emacs line numbers

When editing a file in emacs, you can choose to display the line numbers just like the other text editors. show which line number First lets see how you can find the current line number that the point is in the buffer. This is useful if you don’t have line numbers enabled in the buffer. M-x what-line This will print…

how to abort, quit and exit emacs

save buffers and exit emacs

There is a long standing joke about the vim text editor which somehow depicts the complexity of the text editors when it comes to newbies……It usually goes something like this. “I have been using vi editor for two years….mostly because I cannot figure out how to exit.” Something that can be said about emacs as well, but it does have…

how to save a file or buffer in emacs editor

save file in emacs

If you have worked with emacs then you might be familiar with the concept of buffers. It is similar to what other editors might call tabs or files. In emacs, it refers to the contents of some file or directory that you had opened and it is a copy of the contents of those files. So the contents of the…

how to sort text, lines and fields in the emacs editor

sort text in emacs

Emacs has several different ways of sorting text in the buffer. You can sort lines, paragraphs and also sort text based on fields or words in the line. Sort Lines This is probably the simplest of all sorting method. The sort-lines command sorts all lines in the active region. Select the region in the buffer that you want to sort…

how to go to a specific line number in emacs

go to line in emacs

One of the common forms of navigation with in a text editor is the ability to go to specific line in the buffer by using the line number. In emacs, you can browse or navigate the buffer in several different ways and the “go to line number” feature is just one of them. The function in emacs that performs this…

how to delete lines and sentences in emacs in linux

emacs delete blank lines

There are so many different text editors in Linux to choose from. Vi and emacs are probably two of the well known editors. There are probably several hundreds more..but as you are here you probably use emacs. Although emacs is not technically just a text editor, it does have text editing capabilities and we will consider it to be one…

how to change encoding in gedit text editor

gedit file open dialog

GEdit is one most popular text editor in Linux desktops. It comes with a whole lot of functionalities. Often times you will need to change the encoding of the file you are viewing in the editor. Many of the editors provide you with the ability to change the file encoding on the fly. We will see how we can change…

linux: how to replace text in file from command line

vi editor and search expressions

Linux has several different utilities that can perform string or text manipulation. Depending on your environment and the tools that are available, you should be able to easily parse, find and replace any string in a text file. Almost every single text editor comes with a find and replace feature with a UI, so we are going to only explore…

vi editor: how to go to a line by line number

vi editor and search expressions

The vi or vim editor is the popular and feature rich editor for editing text files in Linux. You can go to a particular line in the editor in several ways depending on where you are accessing it from. from the command line If you are opening a file from the command line, and you want the cursor at a…