LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mg

micro GNU Emacs-style editor

TLDR

Open a file
$ mg [file.txt]
copy
Open a file at a specific line
$ mg +[10] [file.txt]
copy
Open in read-only mode
$ mg -R [file.txt]
copy
Open multiple files (switch with C-x b)
$ mg [file1.txt] [file2.txt]
copy

SYNOPSIS

mg [options] [files]

DESCRIPTION

mg is a micro GNU Emacs-style editor. It provides basic Emacs keybindings in a lightweight package, making it ideal for quick edits on minimal systems.Common keybindings: C-x C-s (save), C-x C-c (quit), C-x C-f (open file), C-s (incremental search), C-x b (switch buffer), C-x k (kill buffer), C-space (set mark), C-w (cut region), M-w (copy region), C-y (paste), C-x u (undo).mg is the default editor on OpenBSD and is available on other BSD and Linux systems.

PARAMETERS

FILES

Files to edit.
+ LINE
Start at specified line number.
-R
Read-only (view) mode.
-n
Turn off backup file generation.
-f mode
Run the given mode at startup (e.g., -f auto-fill-mode).

CAVEATS

Much more limited than GNU Emacs. No Emacs Lisp extension support, no syntax highlighting, no Unicode support. Intended for basic text editing only.

HISTORY

mg was originally named MicroGNUEmacs (later shortened to mg), created in 1986 by Dave Conroy for systems where full GNU Emacs was too large. It was subsequently maintained by various contributors and is now part of the OpenBSD base system.

SEE ALSO

emacs(1), nano(1), vi(1)

Copied to clipboard
Kai