36

For reference, I know very little about Linux, and am using it to run a program written by someone else. The instructions say 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.

How do I go about doing this?

This executable is currently in a subfolder in the host area, as it's running on a dual-boot computer I cannot change the fact that it is a dual boot, as it is a work computer.

2 Answers 2

42

To make this work for the command line (terminal):

I would suggest that you do the following steps in the terminal:

  1. Create a folder called bin in your home directory.

    mkdir ~/bin
    
  2. Add ~/bin to your PATH for all sessions of Bash (the default shell used inside of the terminal).

    $ 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. Add either the executable files themselves OR symlinks to the executable into ~/bin

  4. Restart your terminal session by closing out the terminal and reopening it, or run source ~/.bashrc to reload the configuration for your session

That should allow your terminal to read the PATH variable for terminal sessions.

I do not know how to add it to the GUI, though, as I'm not certain of how the GUI manages the PATH variable(s), but it might be necessary to modify the path with other methods should this method here not work with the GUI.

5
  • 7
    Can't you just source ~/.bashrc instead of closing and reopening the terminal? Oct 20, 2016 at 16:28
  • 1
    @wordsforthewise you can, yes. (Considering I wrote this well over 3 years ago when I wasn't the linux professional I am now, I hadn't known that heh. (Adding shortly)
    – Thomas Ward
    Oct 20, 2016 at 16:30
  • 2
    @wordsforthewise some imperfect ~/.bashrc's behave strangely when sourced twice. Mar 20, 2018 at 12:54
  • 2
    @styrofoamfly that's why you never have an imperfect ~/.bashrc ;) Mar 20, 2018 at 21:58
  • I think the answer could be improved if you added an example of point 3 as symlinks aren't so commonly used.
    – PhoneixS
    Oct 9, 2020 at 9:38
1

to just temporary add the local directory to your path call this:

PATH="$(pwd):$PATH"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .