← 返回命令列表

Linux command

subl 命令

文件

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

常用示例

Open a file

subl [path/to/file]

Open a file at a specific line

subl [path/to/file]:[line]:[column]

Open a directory

subl [path/to/directory]

Open files in a new window

subl -n [file1] [file2]

Add folders to the current window

subl -a [path/to/directory]

Wait for files to close

subl -w [path/to/file]

Open from stdin

echo "[text]" | subl -

说明

subl is the command-line interface for Sublime Text, a popular cross-platform text editor. It allows opening files and directories from the terminal and integrating with Unix tools like git and subversion. Files can include a :line or :line:column suffix to open at a specific location (1-based). The tool can read from stdin using -. When used with -w, it blocks until files are closed, making it suitable as an external editor for version control systems (e.g., `EDITOR='subl -w' git commit`).

参数

-n, --new-window
Open a new window instead of reusing an existing instance.
-a, --add
Add folders to the current window instead of opening a new window.
-w, --wait
Wait for the files to be closed before returning. Useful for version control editors.
-b, --background
Open files without activating the application window.
--project _project_
Load a specific .sublime-project or .sublime-workspace file.
--command _command_
Execute a Sublime Text internal command (e.g., save_all, build).
--safe-mode
Launch in a sandboxed clean environment without plugins.
--launch-or-new-window
Only open a new window if the application is already running.
-v, --version
Print version information and exit.
-h, --help
Display help message and exit.

FAQ

What is the subl command used for?

subl is the command-line interface for Sublime Text, a popular cross-platform text editor. It allows opening files and directories from the terminal and integrating with Unix tools like git and subversion. Files can include a :line or :line:column suffix to open at a specific location (1-based). The tool can read from stdin using -. When used with -w, it blocks until files are closed, making it suitable as an external editor for version control systems (e.g., `EDITOR='subl -w' git commit`).

How do I run a basic subl example?

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

What does -n, --new-window do in subl?

Open a new window instead of reusing an existing instance.