如何在红旗linux桌面右键菜单添加“打开终端”快捷方式?

如何在红旗linux桌面右键菜单添加“打开终端”快捷方式?,第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

添加完后,把此文件加上可执行的权限。

可通过设置快捷键和通过脚本实现,具体如下:

一、设置快捷键

首选项 -->屏幕快捷键,然后添加一个命令,并添加一个你的快捷键,如果你用的是gnome桌面建议用

gnome-terminal命令添加快捷键,也可以用xterm,还可以用shell脚本,比如我用的是调用下面我贴的一个脚本

命令(脚本见文代码):

/home/zhangwei/.gnome2/nautilus-scripts/打开终端

二、设置右键快捷键(打开时为当前目录)

方法一:

执行命令:

sudo apt-get install nautilus-open-terminal

此方法是安装一个小软件,但是我安装后和conky冲突了,所以没有用。

方法二:

用脚本,把下面的脚本保存成任意名(我的是:打开终端),然后放在主目录的.gnome2/nautilus-scripts目录下,当然你可以放一些其他常见的脚本,都可以在右键找到。比如发送到邮件/修改文件权限等等实用的功能。

脚本:

#!/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

1、ctrl+alt+F1~F6之间使用,这是纯终端使用

2、在linux桌面环境下,鼠标点击程序菜单,找到一般为实用程序或者系统工具类的菜单中找到终端程序

3、还一种是调试模式的终端模式,在开机时候esc键,根据linux版本不同,进入方式也不同,这一般为系统出现故障才使用的终端模式

4、可以使用类似SSH类型的软件,远程登录终端,这属于网络版终端,使用终端服务器软件,远程开启终端,这需要配置终端服务器


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/8018077.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-12
下一篇2023-04-12

发表评论

登录后才能评论

评论列表(0条)

    保存