Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux 終端使用 xdg-open 指令以預設圖形應用程式開啟檔案與目錄

編輯:關於 Linux

終端操作時需開啟圖形檔案 (PDF、圖片、文檔) 卻記不住對應指令?xdg-open 統一調用桌面環境預設關聯程式,跨 GNOME/KDE 通用。

常用範例

# 以預設 PDF 閱讀器開啟
xdg-open xxx.pdf

# 以檔案管理器開啟家目錄
xdg-open ~

# 開啟網址 (預設瀏覽器)
xdg-open https://example.com

指令語法

xdg-open { file | URL }
xdg-open { --help | --manual | --version }

優勢

  • 與圖形介面雙擊行為一致,無需記憶各類檔案對應程式名稱。
  • 支援 file、ftp、http、https 協議。
  • 配合 Ctrl+Alt+T 開啟終端、F11 全螢幕,大幅減少滑鼠切換,提升效率。

注意

僅適用於圖形桌面會話,不建議以 root 執行。

掌握此指令,終端處理檔案更加得心應手。

Copyright © Windows教程網 All Rights Reserved