← 返回命令列表

Linux command

emacs 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Open Emacs

emacs [path/to/file]

Open a file

emacs +[42] [path/to/file]

Open a file

emacs +[42]:[10] [path/to/file]

Run Emacs in terminal mode

emacs -nw [path/to/file]

Start Emacs without loading init files

emacs -q

Evaluate an Elisp expression

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

Run Emacs as a daemon

emacs --daemon

Connect to an Emacs daemon

emacsclient [path/to/file]

说明

emacs is an extensible, customizable, self-documenting text editor and computing environment. Far beyond a simple editor, it includes facilities for email, file management, terminal emulation, web browsing, and thousands of other functions through its extension system. Emacs is built around Emacs Lisp (Elisp), a full programming language that allows users to customize and extend virtually every aspect of the editor. User configurations are stored in ~/.emacs or ~/.emacs.d/init.el. The editor operates in different modes depending on the file type, providing syntax highlighting, indentation, and mode-specific commands. Major modes handle different file types, while minor modes add optional features. The built-in help system is accessed with C-h (Ctrl+h) or F1.

参数

-nw, --no-window-system
Run in terminal mode without GUI (text terminal)
-q, --no-init-file
Do not load the user init file (~/.emacs)
--no-site-file
Do not load the site-wide startup file
-u _USER_, --user _USER_
Load specified user's init file
-t _FILE_, --terminal _FILE_
Use specified file as terminal
--debug-init
Enable Emacs Lisp debugger during init file processing
--batch
Run in batch mode (non-interactive)
--script _FILE_
Run specified file as an Emacs Lisp script
--eval _EXPRESSION_
Evaluate Emacs Lisp expression
-l _FILE_, --load _FILE_
Load specified Emacs Lisp file
-f _FUNCTION_, --funcall _FUNCTION_
Execute specified Emacs Lisp function
--daemon
Start Emacs as a background daemon
-Q, --quick
Start with minimal configuration (implies -q --no-site-file --no-splash)
--geometry _WIDTHxHEIGHT+X+Y_
Set window geometry (X11)
-fs, --fullscreen
Start in fullscreen mode
-fw, --fullwidth
Make window as wide as the screen
-fh, --fullheight
Make window as tall as the screen
-fg _COLOR_
Set foreground color
-bg _COLOR_
Set background color
-d _DISPLAY_, --display _DISPLAY_
Use specified X display
--version
Display version information
--help
Display help information

FAQ

What is the emacs command used for?

emacs is an extensible, customizable, self-documenting text editor and computing environment. Far beyond a simple editor, it includes facilities for email, file management, terminal emulation, web browsing, and thousands of other functions through its extension system. Emacs is built around Emacs Lisp (Elisp), a full programming language that allows users to customize and extend virtually every aspect of the editor. User configurations are stored in ~/.emacs or ~/.emacs.d/init.el. The editor operates in different modes depending on the file type, providing syntax highlighting, indentation, and mode-specific commands. Major modes handle different file types, while minor modes add optional features. The built-in help system is accessed with C-h (Ctrl+h) or F1.

How do I run a basic emacs example?

Run `emacs [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -nw, --no-window-system do in emacs?

Run in terminal mode without GUI (text terminal)