每当我打开一个 .sh 文件时,它都会在 gedit 而不是终端中打开它。我找不到任何类似于Right Click 的选项?打开方式?其他应用...?终端。
如何在终端中打开此文件?
当我在 Nautilus 中双击脚本来运行它时,该脚本只是在我的文本编辑器中打开,没有运行它的选项。使用 Nautilus,我如何运行可执行文本文件和/或脚本?
我想编写“批处理文件”(shell 脚本)的 Ubuntu 模拟。但是我不知道如何使用命令来制作它以便可以运行脚本。我也不知道在哪里使用它。chmod +x filename
最近我发现 command:command没有手动输入,但帮助显示如下:
$ help command
command: command [-pVv] command [arg ...]
Execute a simple command or display information about commands.
Runs COMMAND with ARGS suppressing shell function lookup, or display
information about the specified COMMANDs. Can be used to invoke commands
on disk when a function with the same name exists.
Options:
-p use a default value for PATH that is guaranteed to find all of
the standard utilities
-v print a description of COMMAND similar to the …Run Code Online (Sandbox Code Playgroud) 如何在另一个终端窗口中运行任何命令?
示例:我打开了一个终端窗口,如果我运行类似 的命令apropos editor,则它会在该窗口上运行并输出。但我想在另一个终端窗口(新窗口)上运行相同的命令,而不是在第一个终端的当前窗口上运行。
进一步说明:
我需要suggest-command <command>打开新的终端窗口并运行<command>该(新打开的)窗口中提到的。(suggest-command命令的建议示例在哪里。)
怎么做?
我有以下rc.local脚本:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sh /home/incero/startup_script.sh
/bin/chmod +x /script.sh
sh /script.sh
exit 0
Run Code Online (Sandbox Code Playgroud)
第一行,startup_script.sh实际下载第三行中提到的script.sh文件/script.sh。
不幸的是,它似乎没有使脚本可执行或运行脚本。 …
我最近禁用了sudo的身份验证缓存功能,因此它现在每次都提示我输入密码。
虽然这对安全性有好处,但它导致了一个我无法找到解决方案的小问题,我无法运行以下命令:
sudo <command> &
Run Code Online (Sandbox Code Playgroud)
在过去,我会在此sudo之前运行一个命令,它会缓存我的密码并允许我sudo在接下来的几分钟内不提示地运行命令,因此它允许我运行该命令。
但是当我现在运行它时,因为事先没有缓存并且它立即启动一个新线程并且sudo甚至不提示我输入密码,我无法以这种方式运行它。
因此,除非我sudo -i在它之前运行,否则我无法以这种格式运行命令,这变得相当烦人。
所以我想知道是否有任何方法可以解决这个问题并仍然以这种方式运行程序和命令?
我正在使用 GNOME 3.18 运行 Ubuntu GNOME 15.10,特别是我想以这种方式运行的程序etherape是否有任何不同,但我真的希望该解决方案适用于所有程序和命令。
我只是想知道,例如当我启动qtox时:
qtox &
Run Code Online (Sandbox Code Playgroud)
然后关闭终端,qtox用它关闭。但是在运行时etherape使用:
sudo etherape &
Run Code Online (Sandbox Code Playgroud)
关闭终端不会关闭或对 Etherape 造成任何问题。并且在不同的应用程序之间有不同的行为,有些在终端关闭时关闭,有些则没有,这是怎么回事?为什么有些人关闭而其他人不关闭?我正在使用 GNOME 3.18 运行 Ubuntu GNOME 15.10。
我有一台运行几个 vagrant VM 的机器。我遇到的问题是,有时我在关闭或重新启动机器之前忘记关闭这些虚拟机。因此,我的机器卡住了这条消息:waiting for vboxnet0 to become free
我搜索了解决方案,我找到了这个页面:
http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown
我尝试了关闭它们的方法,但它不起作用。
我为该命令编写了一个 sh 文件:
#!/bin/bash
cd ~/workspace/git/mediaservice
vagrant halt
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我是一个新用户,刚刚被告知要运行/执行命令。答案有一些带有灰色背景的文本,例如this text here或
sometimes this text here.
Run Code Online (Sandbox Code Playgroud)
但是,我不知道与 Ubuntu 相关的“运行”或“命令”是什么意思。
我该怎么做呢?
这旨在用作问答,当您告诉某人运行命令时,您可以链接到该问答。
execute-command ×10
command-line ×5
scripts ×3
bash ×2
sudo ×2
chmod ×1
executable ×1
nautilus ×1
permissions ×1
reboot ×1
security ×1
shutdown ×1
startup ×1