Answers:
据我所知,基于我所知道和经历的:
sudo
用于命令行应用程序/命令,gksudo
当您尝试通过按Alt + F2 使用“ 运行应用程序”对话框窗口运行程序时,此功能很有用。
我读过gksudo
的只是的图形版本sudo
。
无论如何,您都可以在终端中sudo nautilus
和/或gksu nautilus
在终端中进行您想要的操作,这两个命令的效果相同。但是,如果您想省略该终端,并且希望通过“ 运行应用程序 ”对话框窗口直接运行该终端,只需按Alt + F2并gksu nautilus
输入,然后会提示您输入密码,然后将打开nautilus文件浏览器具有root特权。
此外,通过右键单击“以管理员身份打开”选项,您可以单击一次以root用户身份打开文件/文件夹。无论如何,它将为给定的文件夹打开一个新的nautilus实例,并以root用户身份打开文件,这也可能以root用户身份打开/运行应用程序,但我尚未对其进行测试。
您可以通过以下方式在上下文菜单中获得“以管理方式打开”选项:通过命令行安装nautilus-gksu:sudo apt-get install nautilus-gksu
或使用下图所示的突触:
祝好运!
nautilus-gksu
从Ubuntu 12.04开始,@ jcollum 在存储库中不再存在。
您需要以根用户身份运行Nautilus
在终端输入
gksu nautilus
现在您可以使用GUI进行移动。
或使用此命令
sudo mv -r /home/user/temp/<foldername>/ /opt/
gksu nautilus "/path/to/dir/pasted/here"
路径周围的引号很重要)
这是我用来打开admin(根)Nautilus窗口的nautilus脚本:
#!/bin/bash
# This Nautilus script opens the current nautilus window in admin mode.
# Requires: perl, liburi-perl
ERROR_NEED_PERL="This script requires the liburi-perl package. Install it and try again."
GKSUDO_MESSAGE="Enter your password to open an admin window on: "
ERROR_BROKEN_LINK="Broken link."
## Check for liburi-perl (and hence perl)
let PERLOK=$(dpkg-query -W --showformat='${Status}\n' liburi-perl|grep "install ok installed")
if [ "" == "$PERLOK" ]; then
zenity --error --text "$ERROR_NEED_PERL"
exit 1
fi
let LEN_NSSFP=${#NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}-1
[ $LEN_NSSFP -lt 0 ] && let LEN_NSSFP=0
let LEN_NSSU=${#NAUTILUS_SCRIPT_SELECTED_URIS}-1
[ $LEN_NSSU -lt 0 ] && let LEN_NSSU=0
## if clicking happens on the Desktop (or a file or folder on it),
## $1 will be a path (i.e. with "/" in it); otherwise (in a folder
## window) $1 will be just a file or folder name (without path).
## Note that selecting the home desktop namespace extension yields
## a $# of zero but NAUTILUS_SCRIPT_SELECTED_FILE_PATHS pointing to the
## target (in the computer (computer:///) and trash (trash:///) desktop
## namespace extension cases, ...PATHS is empty).
## Initially, we stripped the file:// prefix from NAUTILUS...CURRENT_URI,
## yielding the full path, and then retrofit spaces, like this:
#OBJECT="`echo -n $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"
## However, this fails if any special characters other than spaces are in the path,
## such as accented letters, etc. We need to convert not just spaces, but any
## UTF-8 embedded in there...The URI<->path conversion requires perl (and liburi-perl):
OBJECT=$( echo "$NAUTILUS_SCRIPT_CURRENT_URI" | perl -MURI -le 'print URI->new(<>)->dir' )
## ->file is to be used for file URIs instead of ->dir, which is for directory URIs
CONTEXT="$OBJECT"
## Add the selection to the path, if defined and unique
if [ $# -eq 1 ] ; then
## If a single Desktop object, override
if echo $1 | grep -q "/" ; then ## Desktop (or object on desktop)
OBJECT="$1"
CONTEXT=""
else ## $1 is a simple file or folder name, without a path
## The container could be root (/)
OBJECT="${OBJECT%/}/$1"
fi
# elif [ $# -eq 0 -a -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ] ; then
elif [ $# -eq 0 ] ; then
## desktop name space extension selected?
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ] ; then ## Home
OBJECT="${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS:0:LEN_NSSFP}"
elif [ -n "$NAUTILUS_SCRIPT_SELECTED_URIS" ] ; then ## Computer, Trash
## These typically map to root (/)
# OBJECT="`echo ${NAUTILUS_SCRIPT_SELECTED_URIS:0:LEN_NSSU} | cut -d'/' -f3- | sed 's/%20/ /g'`"
OBJECT="${NAUTILUS_SCRIPT_SELECTED_URIS:0:LEN_NSSU}"
OBJECT=$( echo "$OBJECT" | perl -MURI -le 'print URI->new(<>)->dir' )
fi
CONTEXT=""
fi
## Note that a desktop shortcut (.desktop file) does not trip -h
if [ -h "$OBJECT" ] ; then ## symbolic link
## readlink has no "follow symlinks as far as they exist" option
OBJECT=`readlink -e "$OBJECT"`
if [ -z "$OBJECT" ] ; then
zenity --error --text "$ERROR_BROKEN_LINK"
exit 1
fi
fi
# zenity --info --text "\$OBJECT is « $OBJECT »"
if [ -f "$OBJECT" ] ; then
## Regular file
DIR=`dirname "$OBJECT"`
else
## Directory (or no object)
DIR="$OBJECT"
fi
## If DIR is empty, gnome-open opens in the default (home) directory (i.e. "~") anyway
#if [ -z "$DIR" ] ; then
# DIR=~
#fi
## At this point, the test [ ! "$CONTEXT" = "$DIR" ] serves to indicate
## that the target directory is not matched to the one the script was
## invoked from (if any).
gksudo --message "$GKSUDO_MESSAGE$DIR" gnome-open "$DIR"
exit $?
sudo mv /home/user/temp/[Filename] /opt
而是[Filename]
键入文件名,不要使用方括号[]
。