EMACS(1) General Commands Manual EMACS(1)
emacs - GNU project Emacs editor
| Use Case | Command | Description |
|---|---|---|
| ๐ Open file | emacs file | Edit file |
| ๐ข Jump to line | emacs +25 file | Go to line 25 |
| โก Start as daemon | emacs --daemon | Start Emacs server in background |
| ๐ Batch script | emacs --batch -l script.el -f my-func | Run Lisp script nonโinteractively |
| ๐ฅ๏ธ No window | emacs -nw | Run in terminal (no GUI frame) |
| ๐จ Set colors | emacs -fg white -bg darkblue --reverse-video | Custom foreground/background |
| ๐งช Debug init | emacs --debug-init | Enable debugger on ~/.emacs |
| ๐ Insert file | emacs --batch --insert=input.txt --eval='(message "done")' --kill | Insert file content and quit |
emacs [ command-line switches ] [ files ... ]
GNU Emacs is a version of Emacs, written by the author of the original (PDP-10) Emacs, Richard Stallman. The user functionality of GNU Emacs encompasses everything other editors do, and it is easily extensible since its editing commands are written in Lisp.
The primary documentation of GNU Emacs is in the GNU Emacs Manual, which you can read using Info, either from Emacs or as a standalone program. Please look there for complete and upโtoโdate documentation. This man page is updated only when someone volunteers to do so.
Emacs has an extensive interactive help facility, but the facility assumes that you know how to manipulate Emacs windows and buffers. CTRL-h or F1 enters the Help facility. Help Tutorial (CTRL-h t) starts an interactive tutorial to quickly teach beginners the fundamentals of Emacs. Help Apropos (CTRL-h a) helps you find a command with a name matching a given pattern, Help Key (CTRL-h k) describes a given key sequence, and Help Function (CTRL-h f) describes a given Lisp function.
GNU Emacs's many special packages handle mail reading (RMail) and sending (Mail), outline editing (Outline), compiling (Compile), running subshells within Emacs windows (Shell), running a Lisp readโevalโprint loop (LispโInteractionโMode), automated psychotherapy (Doctor), and much more.
The following options are of general interest:
file โ ๐ Edit file.--file=file, --find-file=file, --visit=file โ ๐ The same as specifying file directly as an argument.+number โ ๐ข Go to the line specified by number (no space between + and number). Applies only to the next file.+line:column โ ๐ข Go to the specified line and column.--chdir=directory โ ๐ Change to directory.-q, --no-init-file โ ๐ซ Do not load an init file.-nl, --no-shared-memory โ ๐ง Do not use shared memory.--no-site-file โ ๐ Do not load the siteโwide startup file.-nsl, --no-site-lisp โ ๐ซ Do not add siteโlisp directories to loadโpath.--no-desktop โ ๐ป Do not load a saved desktop.-Q, --quick โ โก Similar to -q --no-site-file --no-splash. Also avoids processing X resources.--no-splash โ ๐ซ Do not display a splash screen on startโup.--debug-init โ ๐ Enable Emacs Lisp debugger during ~/.emacs processing.-u user, --user=user โ ๐ค Load user's init file.-t file, --terminal=file โ ๐ฅ๏ธ Use specified file as terminal instead of stdin/stdout. Must be first argument.--daemon[=name], --bg-daemon[=name] โ โ๏ธ Start Emacs as a daemon, enabling emacsclient connection (optional name).--fg-daemon[=name] โ โ๏ธ Like --bg-daemon but donโt disconnect from terminal.--version โ โน๏ธ Display Emacs version and exit.--help โ โ Display this help and exit.The following options are Lispโoriented (processed in order):
-f function, --funcall=function โ ๐งฎ Execute the lisp function function.-l file, --load=file โ ๐ Load the lisp code in file.--eval=expr, --execute=expr โ ๐งช Evaluate the Lisp expression expr.The following options are useful when running Emacs as a batch editor:
--batch โ ๐ Edit in batch mode. Messages to stderr. Use -l and -f to specify files and functions.--script file โ ๐ Run file as an Emacs Lisp script.--insert=file โ ๐ Insert contents of file into the current buffer.--kill โ ๐ Exit Emacs while in batch mode.-L dir, --directory=dir โ ๐ Add dir to the list of directories searched for Lisp files.Emacs has been tailored to work well with the X window system. If you run Emacs from under X windows, it will create its own X window to display in. You will probably want to start the editor as a background process so that you can continue using your original window.
Emacs can be started with the following X switches:
--name=name โ ๐ท๏ธ Specify the name assigned to the initial Emacs window (affects X resources and title).-T name, --title=name โ ๐ท๏ธ Specify the title for the initial X window.-r, -rv, --reverse-video โ ๐ Display the Emacs window in reverse video.-fn font, --font=font โ ๐ค Set the Emacs windowโs font. Only fixedโwidth fonts are accepted. See xlsfonts(1) for font info.--xrm=resources โ โ๏ธ Set additional X resources.--color, --color=mode โ ๐จ Override color mode for character terminals (default auto; can be never, always, or mode name like ansi8).-bw pixels, --border-width=pixels โ ๐ Set border width in pixels (default 1).-ib pixels, --internal-border=pixels โ ๐ Set internal border width (default 1 pixel padding).-g geometry, --geometry=geometry โ ๐ Set window width, height, position. Format: WxH+X+Y (characters). Default width 80, height 35โ40 for GUI.-lsp pixels, --line-spacing=pixels โ ๐ Additional space between lines.-vb, --vertical-scroll-bars โ ๐ Enable vertical scrollbars.-fh, --fullheight โ ๐ Make the first frame as high as the screen.-fs, --fullscreen โ ๐ Make the first frame fullscreen.-fw, --fullwidth โ ๐ Make the first frame as wide as the screen.-mm, --maximized โ ๐ Maximize the first frame (equivalent to -fw -fh).-fg color, --foreground-color=color โ ๐จ Set text color. Use M-x list-colors-display for valid color names.-bg color, --background-color=color โ ๐จ Set background color.-bd color, --border-color=color โ ๐จ Set border color.-cr color, --cursor-color=color โ ๐จ Set cursor color.-ms color, --mouse-color=color โ ๐จ Set mouse cursor color.-d displayname, --display=displayname โ ๐ฅ๏ธ Create window on the specified X display. Must be the first option.-nbi, --no-bitmap-icon โ ๐ซ Do not use picture of gnu for Emacs icon.--iconic โ ๐ผ๏ธ Start Emacs in iconified state.-nbc, --no-blinking-cursor โ ๐ซ Disable blinking cursor.--parent-id=xid โ ๐ช Set parent window (X ID).-nw, --no-window-system โ ๐ฅ๏ธ Do not create a graphical frame. Use terminal window (e.g., xterm).-D, --basic-display โ ๐ Disable many display features; useful for debugging.You can set X default values for your Emacs windows in ~/.Xresources (see xrdb(1)). Use the format:
emacs.keyword:value
Available keyword settings:
background (class Background) โ ๐จ Window background color.bitmapIcon (class BitmapIcon) โ ๐ผ๏ธ If on, iconify into โkitchen sinkโ.borderColor (class BorderColor) โ ๐จ Border color.borderWidth (class BorderWidth) โ ๐ Border width in pixels.cursorColor (class Foreground) โ ๐จ Text cursor color.cursorBlink (class CursorBlink) โ ๐ก Cursor blink on/off (default on).font (class Font) โ ๐ค Text font.foreground (class Foreground) โ ๐จ Text color.fullscreen (class Fullscreen) โ ๐ Desired fullscreen size: fullboth, maximized, fullwidth, fullheight.geometry (class Geometry) โ ๐ Window geometry as described above.iconName (class Title) โ ๐ท๏ธ Icon name for the window icon.internalBorder (class BorderWidth) โ ๐ Internal border width in pixels.lineSpacing (class LineSpacing) โ ๐ Additional space between lines.menuBar (class MenuBar) โ ๐ Give frames menu bars (on) or not (off). See Emacs manual for Lucid/Motif resources.minibuffer (class Minibuffer) โ ๐ฅ If none, use a separate minibuffer frame.paneFont (class Font) โ ๐ค Font for menu pane titles (nonโtoolkit versions).pointerColor (class Foreground) โ ๐จ Mouse cursor color.privateColormap (class PrivateColormap) โ ๐จ Use private color map if on and default visual is PseudoColor.reverseVideo (class ReverseVideo) โ ๐ Display window in reverse video if on.screenGamma (class ScreenGamma) โ ๐
Gamma correction (frame parameter screen-gamma).scrollBarWidth (class ScrollBarWidth) โ ๐ Scroll bar width in pixels (frame parameter scroll-bar-width).selectionFont (class SelectionFont) โ ๐ค Font for popโup menu items (nonโtoolkit).selectionTimeout (class SelectionTimeout) โ โฑ๏ธ Milliseconds to wait for selection reply (0 = wait indefinitely).synchronous (class Synchronous) โ ๐ Run X in synchronous mode if on (debugging).title (class Title) โ ๐ท๏ธ Window title.toolBar (class ToolBar) โ ๐งฐ Number of lines to reserve for the tool bar.tabBar (class TabBar) โ ๐ Number of lines to reserve for the tab bar.useXIM (class UseXIM) โ โจ๏ธ Turn off X input methods (XIM) if false or off.verticalScrollBars (class ScrollBars) โ ๐ Give frames scroll bars (on) or suppress (off).visualClass (class VisualClass) โ ๐ผ๏ธ Specify X visual: TrueColor, PseudoColor, DirectColor, StaticColor, GrayScale, StaticGray followed by -depth.You can order printed copies of the GNU Emacs Manual from the Free Software Foundation, which develops GNU software. See the online store at https://shop.fsf.org/.
Your local administrator might also have copies available. As with all software and publications from FSF, everyone is permitted to make and distribute copies of the Emacs manual. The Texinfo source to the manual is also included in the Emacs source distribution.
/usr/local/share/info โ ๐ Files for the Info documentation browser. Includes the complete Emacs reference manual, Emacs Lisp Reference Manual, and Introduction to Programming in Emacs Lisp./usr/local/share/emacs/$VERSION/lisp โ ๐ Lisp source and compiled files defining most editing commands. Some are preloaded; others autoloaded./usr/local/libexec/emacs/$VERSION/$ARCH โ ๐ ๏ธ Various programs used with GNU Emacs./usr/local/share/emacs/$VERSION/etc โ ๐ Various information files./usr/local/share/emacs/$VERSION/etc/DOC.* โ ๐ Documentation strings for Lisp primitives and preloaded Lisp functions.There is a mailing list, bug-gnu-emacs AT gnu.org, for reporting Emacs bugs and fixes. Before reporting, please verify it is a bug and not a misunderstanding or feature. Read the โReporting Bugsโ section in the Emacs manual. Include the Emacs version number in every bug report. Isolated bugs are more likely to be fixed.
Do not expect a personal answer. The goal is to fix bugs for the next release. For personal assistance, consult the service directory at https://www.fsf.org/resources/service/.
Please send only bug reports to this list. For other Emacs lists, see https://savannah.gnu.org/mail/?group=emacs.
Emacs is free; anyone may redistribute copies of Emacs to anyone under the terms stated in the GNU General Public License, a copy of which accompanies each copy of Emacs and which also appears in the reference manual.
Copies of Emacs may sometimes be received packaged with distributions of Unix systems, but it is never included in the scope of any license covering those systems. Such inclusion violates the terms on which distribution is permitted. The primary purpose of the GNU General Public License is to prohibit anyone from attaching any other restrictions to redistribution of Emacs.
Richard Stallman encourages you to improve and extend Emacs, and urges that you contribute your extensions to the GNU library. Eventually GNU (Gnuโs Not Unix) will be a complete replacement for Unix. Everyone will be free to use, copy, study and change the GNU system.
emacsclient(1), etags(1), X(7), xlsfonts(1), xterm(1), xrdb(1)
Emacs was written by Richard Stallman and the Free Software Foundation. For detailed credits and acknowledgments, see the GNU Emacs manual.
Copyright 1995, 1999โ2020 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this document under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this document into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.
GNU Emacs 27.1 2007 April 13 EMACS(1)
Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 17:38 @2600:1f28:365:80b0:f8a4:e764:d6bb:8e66
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format