如何在搜索路径中添加可执行文件?

作为参考,我对Linux知之甚少,并且正在使用它来运行其他人编写的程序。 说明说Add the executable 'ttt' to the search path. In most installations this can be accomplished by linking the file to the 'bin' subdirectory at user home. Add the executable 'ttt' to the search path. In most installations this can be accomplished by linking the file to the 'bin' subdirectory at user home.

我该怎么做呢?

此可执行文件当前位于主机区域的子文件夹中,因为它在双启动计算机上运行,​​我无法更改它是双启动的事实,因为它是一台工作计算机。

要使其适用于命令行(终端):

我建议您在终端中执行以下步骤:

  1. 在主目录中创建一个名为bin的文件夹。

     mkdir ~/bin 
  2. ~/bin添加到您的PATH以获取Bash的所有会话(终端内部使用的默认shell)。

     $ nano ~/.bashrc # Add the following to the end of your .bashrc file while using nano # or your text editor of choice: export PATH="/home/$USER/bin:$PATH" 
  3. 将可执行文件本身或符号链接添加~/bin 的可执行文件中

  4. 通过关闭终端并重新打开它来重新启动终端会话,或者运行source ~/.bashrc来重新加载会话的配置

这应该允许您的终端读取终端会话的PATH变量。

我不知道如何将它添加到GUI中,因为我不确定GUI如何管理PATH变量,但如果此方法不起作用,可能需要使用其他方法修改路径用GUI。