Linux Professional Institute LPIC-1 Exam 101

GNU and Unix Commands

Nano and Emacs

In this lesson, we'll compare two popular shell-based editors—GNU Nano and Emacs—and explore their features, keyboard shortcuts, and use cases. While Vi is powerful, Nano and Emacs can be more approachable for newcomers on Linux systems.

Why Choose GNU Nano?

GNU Nano is designed for simplicity: all input goes directly into the document, and commands use the Control (Ctrl) or Meta (Alt or Command on macOS) keys.

Key features of Nano include:

  • Undo and redo
  • Syntax coloring
  • Interactive search and replace
  • Auto-indentation
  • Line numbers
  • Word completion
  • File locking and backup files
  • Internationalization support

The image lists features of GNU Nano, including undo/redo, syntax coloring, interactive search-and-replace, auto-indentation, line numbers, word completion, file locking, backup files, and internationalization support.

Nano Keyboard Shortcuts

Most Nano commands appear at the bottom of the interface, but here are some essentials:

ShortcutAction
Ctrl+6Start selection
Meta+6Copy selection
Ctrl+KCut selection
Ctrl+UPaste
Meta+UUndo
Meta+ERedo
Ctrl+\Replace text
Ctrl+TSpell check current document

The image shows keyboard shortcuts for the Nano text editor, including commands for starting a new session, copying, cutting, and pasting selections.

The image shows keyboard shortcuts for the Nano text editor, including commands for undo, redo, replace text, and spell-check.

Tip

Press Ctrl+G at any time in Nano to open the Help menu. You can also customize Nano by editing your ~/.nanorc file.


Emacs: A Programmable Editor and IDE

Emacs is a highly extensible editor that can function as a full IDE, email client, news reader, or RSS client. Like Nano, typing inserts text directly, but uses more keyboard-driven navigation.

Core capabilities of Emacs include:

  • Syntax highlighting and indentation
  • Integrated compiling, running, and testing
  • Powerful undo/redo and version control integration
  • Extensible architecture via Emacs Lisp
  • Configuration as email, news, or RSS client

The image is a text description of Emacs, highlighting its features as a text editor, IDE, and its ability to be configured as an email, news, or RSS client.

Note

Emacs starts with emacs filename and provides built-in tutorials under Ctrl+h t. Explore packages via M-x package-list-packages.


Feature Comparison

FeatureGNU NanoEmacs
Learning CurveVery gentleSteeper, keyboard-driven
Syntax HighlightingYesYes
Undo/RedoBasicAdvanced (multi-level)
ExtensibilityLimited (.nanorc tweaks)Extensive (Emacs Lisp packages)
Built-in IDE ToolsMinimalCompiler, debugger, REPLs
CustomizationModerateHighly customizable

Watch Video

Watch video content

Previous
Basic File Editing vi