Linux command
mg 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Open a file
mg [file.txt]
Open a file at a specific line
mg +[10] [file.txt]
Open in read-only mode
mg -R [file.txt]
Open multiple files
mg [file1.txt] [file2.txt]
说明
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.
参数
- + _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).
FAQ
What is the mg command used for?
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.
How do I run a basic mg example?
Run `mg [file.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does + _LINE_ do in mg?
Start at specified line number.