您现在的位置是:网站首页> 编程资料编程资料
Ubuntu系统下用命令行快速打开各类型文件的方法(xdg-open)_Ubuntu/Debian_操作系统_
2024-03-21
383人已围观
简介 Ubuntu系统下用命令行快速打开各类型文件的方法(xdg-open)_Ubuntu/Debian_操作系统_
在Ubuntu下,通常用命令行打开文本文件,比如用命令gedit、more、cat、vim、less。但当需要打开其他格式文件时,比如pdf、jpg、mp3格式文件,咱们通常做法是进入到文件所在的目录,双击打开,很影响效率。事实上,可以通过命令xdg-open(opens a file or URL in the user's preferred application)打开这些格式文件,甚至是网页,像打开文件一样简单。
先举两个例子:
jelline@jelline:~$ xdg-open la_isla_bonita.mp3
jelline@jelline:~$ xdg-open http://baidu.com
jelline@jelline:~$ 已在现有的浏览器会话中创建新的窗口。
xdg-open会选择合适的程序打开指定文件,跟双击打开效果一样。在我电脑,第一个例子会用Totem Movie Player打开,第二个例子会用谷歌浏览器打开,而不是Firefox,这是因为谷歌浏览器是我默认的浏览器。
具体操作如下:
xdg-open { file | URL }
xdg-open { --help | --manual | --version }
OK,现在是不是方便多了,通过快捷键Ctrl+Alt+T可以打开shell,F11可以全屏显示(Alt+F9最小化窗口,Alt+F10最大化/恢复窗口),再辅予xdg-open命令,极大减少了鼠标操作,也大大提升了效率。
附xdg-open manual部分信息:
xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.
xdg-open is for use inside a desktop session only. It is not recommended to use xdg-open as root.
先举两个例子:
复制代码
代码如下:jelline@jelline:~$ xdg-open la_isla_bonita.mp3
jelline@jelline:~$ xdg-open http://baidu.com
jelline@jelline:~$ 已在现有的浏览器会话中创建新的窗口。
xdg-open会选择合适的程序打开指定文件,跟双击打开效果一样。在我电脑,第一个例子会用Totem Movie Player打开,第二个例子会用谷歌浏览器打开,而不是Firefox,这是因为谷歌浏览器是我默认的浏览器。
具体操作如下:
xdg-open { file | URL }
xdg-open { --help | --manual | --version }
OK,现在是不是方便多了,通过快捷键Ctrl+Alt+T可以打开shell,F11可以全屏显示(Alt+F9最小化窗口,Alt+F10最大化/恢复窗口),再辅予xdg-open命令,极大减少了鼠标操作,也大大提升了效率。
附xdg-open manual部分信息:
xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.
xdg-open is for use inside a desktop session only. It is not recommended to use xdg-open as root.
相关内容
- ubuntu安装微软雅黑字体并设置chrome的字体为微软雅黑_Ubuntu/Debian_操作系统_
- Ubuntu 13.10 编译安装Wine 1.7的步骤_Ubuntu/Debian_操作系统_
- 为使用securecrt在ubuntu系统下手动安装lrzsz的方法_Ubuntu/Debian_操作系统_
- ubuntu12.04 命令行安装Wine1.7的方法_Ubuntu/Debian_操作系统_
- ubuntu创建新用户命令(useradd和adduser)的使用方法和区别_Ubuntu/Debian_操作系统_
- ubuntu系统中安装editplus的方法_Ubuntu/Debian_操作系统_
- ubuntu13.04设置root权限详解_Ubuntu/Debian_操作系统_
- ubuntu14.04 新功能有哪些? ubuntu14.04 新特性汇总_Ubuntu/Debian_操作系统_
- 魔兽世界悬槌堡5号BOSS怎么打_魔兽世界悬槌堡5号BOSS打法攻略_网络游戏_游戏攻略_
- 魔兽世界6.0 5H成就做法攻略大全_网络游戏_游戏攻略_
