I have written or downloaded some programs ( bash scripts, python scripts, java programs, C programs) and placed them under /home/t/program_files/
. For each program, I create a directory under the path, and place all the files for the program in that directory. I even group the programs by their similarity in topics, by further creating directories such as OS
, network
, and document
, and moving the directory of each program into one of such directories. I feel that way helps me manage the programs in a logical way, and I can find the file for a program more quickly.
If I want to run the programs, I have to specify the search paths for all the programs to PATH
.
It can be tedious to manually find out the path to each script or executable file and add it to $PATH
.
One quick way is to recursively add to PATH
all the descendant directories of /home/t/program_files/
, but the problem with this way is that it will add directories which don't directly contain executable or script files but other files such as Java and C source files, and there will be too many paths in PATH
for shell to search for a command in a reasonably long time.
What are some good ways to solve the above problem?
Gilles' reply suggested to use Stow. After a little reading about Stow, I understand that it creates symlinks and the symlinks are still organized in the same ways as their target files, which if I am correct doesn't help with the problem of specifying the search paths of the programs. Am I missing something about Stow which can help with my problem?
Another way which I am wondering about is to go recursively under
/home/t/program_files/
, and check each file whether it is runnable, and if yes, create a symlink to it under/home/t/bin/
and maybe also add its parent directory's pathname toPATH
.Additionally, I believe it is common that one has the needs to create and download third part programs and would like to install them in their home directory. What are some recommended ways to organize such programs? Do they organize the programs not by placing all the files of each program in its own directory?
Thanks.