Linux command
xdg-terminal-exec 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Open the default terminal
xdg-terminal-exec
Run a command
xdg-terminal-exec [command] [args...]
Set a window title
xdg-terminal-exec --title=[My Shell] [command]
Set a working directory
xdg-terminal-exec --dir=[path/to/dir] [command]
Keep the terminal open
xdg-terminal-exec --hold [command]
Print the selected Desktop Entry ID
xdg-terminal-exec --print-id
Show the resolved command line
xdg-terminal-exec --print-cmd [command]
说明
xdg-terminal-exec launches the user's preferred terminal emulator, optionally with a command to execute inside it. It is the reference implementation of the proposed XDG Default Terminal Execution Specification from freedesktop.org. Candidate terminals are discovered from Desktop Entries installed on the system that declare the TerminalEmulator category and provide an X-TerminalArgExec key. The user chooses which of those entries to prefer by listing Desktop Entry IDs in a configuration file. This mirrors tools like xdg-open: instead of hard-coding a terminal in scripts, desktop launchers, or applications, callers invoke xdg-terminal-exec and the system resolves the user's choice at runtime.
参数
- --app-id=_app_id_
- Set the Wayland app-id (or X11 class) of the spawned window.
- --title=_title_
- Set the terminal window title.
- --dir=_workdir_
- Change to _workdir_ before running the command.
- --hold
- Keep the terminal window open after the command terminates.
- --print-id
- Print the Desktop Entry ID that was selected.
- --print-path
- Print the filesystem path of the selected Desktop Entry.
- --print-content
- Print the full content of the selected Desktop Entry.
- --print-cmd=_printf_seq_
- Print the final command line that would be executed instead of running it.
- --print-delimiter=_printf_seq_
- Set the delimiter used between multiple print outputs.
- --
- Treat all following arguments as the command to execute.
FAQ
What is the xdg-terminal-exec command used for?
xdg-terminal-exec launches the user's preferred terminal emulator, optionally with a command to execute inside it. It is the reference implementation of the proposed XDG Default Terminal Execution Specification from freedesktop.org. Candidate terminals are discovered from Desktop Entries installed on the system that declare the TerminalEmulator category and provide an X-TerminalArgExec key. The user chooses which of those entries to prefer by listing Desktop Entry IDs in a configuration file. This mirrors tools like xdg-open: instead of hard-coding a terminal in scripts, desktop launchers, or applications, callers invoke xdg-terminal-exec and the system resolves the user's choice at runtime.
How do I run a basic xdg-terminal-exec example?
Run `xdg-terminal-exec` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --app-id=_app_id_ do in xdg-terminal-exec?
Set the Wayland app-id (or X11 class) of the spawned window.