emacs Command: Tutorial & Examples
Edit text files with the Emacs editor
Emacs is a text editor for Linux and other Unix-based operating systems. It is a highly customizable and extensible editor, with a wide range of features for editing text and programming code.
To start Emacs, you can open a terminal and type emacs
followed by the name of the file you want to edit. For example, to edit a file named file.txt
, you would
enter emacs file.txt
in the terminal.
Once inside Emacs, you can use a variety of keyboard shortcuts and commands to navigate, edit, and save your files. Some common Emacs commands include:
- Saving a file:
Ctrl+x Ctrl+s
- Opening a new file:
Ctrl+x Ctrl+f
- Cut, copy, paste:
Ctrl+w
,Ctrl+y
,Ctrl+k
- Undo:
Ctrl+x u
- Search and replace:
Ctrl+s
,Ctrl+r
- Exit emacs:
Ctrl+x Ctrl+c
Emacs also has a powerful built-in help system, which you can access by typing Ctrl+h
followed by a command. For example, typing Ctrl+h a
will open the emacs manual, and
typing Ctrl+h t
will open the tutorial.
Emacs is a text editor that is known for its extensibility, there are many plug-ins and packages available for Emacs that can add new features and functionality. Some of these plug-ins are aimed at programmers and developers, while others are geared towards writing, data entry and more. Some of the most popular package are:
- org-mode: an organizer and note-taking tool
- magit: a Git integration package
- flycheck: a syntax checking package
Emacs is a powerful and flexible text editor that can be customized to suit the needs of different users. It is widely used by many Linux admins.