免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1543 | 回复: 0
打印 上一主题 下一主题

Ubuntu的右键菜单中添加两个常用命令 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-20 15:12 |只看该作者 |倒序浏览
使用Ubuntu经常需要使用终端或者用管理员身份来打开某个文件夹进行拷贝之类的事情,在右键菜单里添加上这两个命令无疑省了我们很多不必要的麻烦。网上介绍了几种方法,现在把方法记录下来,以备查询。
1.在终端中打开
第一种方法:
安装一个包,即可在右键里面添加一个“打开终端”的菜单。
sudo apt-get install nautilus-open-terminal
第二种方法:
进入主目录的.gnome2/nautilus-scripts目录。新建一个文件,文件名任意(这个文件名会显示在右键菜单里,最好是通俗易懂的,比如“打开终端”或“open-terminal”),文件内容如下。
#!/bin/bash
#
# This script opens a gnome-terminal in the directory you select.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts
# You need to be running Nautilus 1.0.3+ to use scripts.
# When a directory is selected, go there. Otherwise go to current
# directory. If more than one directory is selected, show error.
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
if [ $# -eq 1 ]; then
destination="$1"
# Go to file's directory if it's a file
if [ ! -d "$destination" ]; then
destination="`dirname "$destination"`"
fi
else
zenity --error --title="Error - Open terminal here" \
--text="You can only select one directory."
exit 1
fi
else
destination="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///'`"
fi
# It's only possible to go to local directories
if [ -n "`echo "$destination" | grep '^[a-zA-Z0-9]\+:'`" ]; then
zenity --error --title="Error - Open terminal here" \
--text="Only local directories can be used."
exit 1
fi
cd "$destination"
exec x-terminal-emulator
添加完后,把此文件加上可执行的权限。
chmod +x 文件
2.以管理员身份打开
第一种方法:
打开[新立得],搜索 nautilus-gksu,并安装。重启X后就能在右键中看到这个选项了。
第二种方法:
1、安装程序“Ubuntu Tweak”,关于Ubuntu Tweak的介绍请看: [
Ubuntu Tweak 0.4.2
]
2、在“应用程序”菜单--“系统工具”中打开Ubuntu Tweak。
3、个人设定--脚本--启用脚本“作为root浏览”和“使用文本编辑器打开(作为root)”。
4、用鼠标右键单击任一文件夹或文件,选择“以管理员打开”,就可以进行你想要做的操作了。
(2009-10-20)
by banban


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/104664/showart_2074083.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP