$linuxjunkies
>

emacs(1)

Emacs is a highly extensible and customizable text editor and computing environment.

UbuntuDebianFedoraArch

Synopsis

emacs [OPTION]... [FILE]...

Description

Emacs is a powerful text editor that goes far beyond basic file editing—it's a complete computing environment with built-in support for email, news, debugging, version control, and scripting via Emacs Lisp. It features a modular design that allows users to extend functionality without recompiling.

Emacs operates in modes that provide context-specific keybindings and commands. Major modes handle different file types (Python, C, Markdown, etc.), while minor modes add optional features like spell-checking or line numbering. The editor uses a kill ring for clipboard management and provides both interactive and batch processing capabilities.

Common options

FlagWhat it does
-nwOpen Emacs in terminal mode (no GUI window)
-qDon't load the user's init file (~/.emacs or ~/.emacs.d/init.el)
-l FILELoad Emacs Lisp file before processing command line
-eval EXPREvaluate the Lisp expression EXPR after startup
-batchRun Emacs in batch mode (non-interactive, exits after processing)
+LINE:COLUMNJump to the specified line and column number in the opened file
-fn FONTSet the default font (GUI mode only)
-geometry WxH+X+YSet the window size and position (GUI mode only)
--no-init-fileSame as -q; skip loading init file
-u USERNAMELoad the init file from a different user's home directory

Examples

Open myfile.txt in Emacs (creates a new window or uses existing Emacs session)

emacs myfile.txt

Open myfile.txt in Emacs running in the current terminal window

emacs -nw myfile.txt

Open myfile.txt and position cursor at line 42, column 10

emacs +42:10 myfile.txt

Start Emacs in terminal mode without loading your custom configuration

emacs -q -nw

Run Emacs in batch mode to execute a Lisp expression, then exit immediately

emacs -eval '(message "Hello World")' -batch

Load a custom configuration file before opening myfile.txt

emacs -l ~/.emacs.d/custom-config.el myfile.txt

Run Emacs in batch mode to call a custom function for automated processing

emacs -batch -l process-file.el -f my-batch-function

Start Emacs as a background server for faster subsequent client connections

emacs --daemon

Related commands