Linux command
open.fish 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Open a file with its default application
open [file]
Open a URL in the default browser
open [https://example.com]
Open a directory in the file manager
open [directory]
Open the current directory
open .
Open multiple files
open [file1] [file2] [file3]
说明
open is a built-in function shipped with the Fish shell that opens files, directories, and URLs with the user's default application, regardless of the host operating system. It is defined in share/fish/functions/open.fish in the Fish installation. On macOS and Haiku the function delegates to the native open binary. On other Unix-like systems it dispatches to xdg-open, gnome-open, or kde-open, whichever is present. On systems lacking any of these helpers the function prints an error explaining that no opener is available. Because it is implemented as a Fish function, it only exists inside interactive Fish sessions and is not available to scripts run with sh, bash or zsh.
FAQ
What is the open.fish command used for?
open is a built-in function shipped with the Fish shell that opens files, directories, and URLs with the user's default application, regardless of the host operating system. It is defined in share/fish/functions/open.fish in the Fish installation. On macOS and Haiku the function delegates to the native open binary. On other Unix-like systems it dispatches to xdg-open, gnome-open, or kde-open, whichever is present. On systems lacking any of these helpers the function prints an error explaining that no opener is available. Because it is implemented as a Fish function, it only exists inside interactive Fish sessions and is not available to scripts run with sh, bash or zsh.
How do I run a basic open.fish example?
Run `open [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more open.fish examples?
This page includes 5 examples for open.fish, plus related commands for nearby Linux tasks.