People have suggested adding . to PATH,
which is dangerous because it creates a risk
that you will accidentally run a malicious program
planted in a world-writable directory.
But, if you have executable programs in a few directories
that you own and are writable only by you,
then it’s safe (fairly safe?) to put those director(ies) into PATH,
by adding a line like
PATH=$PATH:~/dev/myprog1:~/dev/myprog2
to your ~/.bashrc file.
Of course this means that you can run a program from one of those directories
from anywhere in the filesystem.
For example, you could cd /etc and type foo,
and it would run ~/dev/myprog1/foo.
This has the minor drawback
that you can’t have programs by the same name
in more than one of the directories.
Specifically, if you have programs called foo
in both ~/dev/myprog1 and ~/dev/myprog2,
you won’t be able to run the second one except by specifying a path.
Likewise if you have a ~/dev/myprog1/cat — but why would you want to?
Another approach, if you have just a few programs that you do this with,
is to define aliases for them:
alias gizmo='./gizmo'
alias gonzo='./gonzo'
Or you can call the aliases .gizmo and .gonzo
if you find that more intuitive.
Actually, this has, to an extent,
the same security risk as putting . into your PATH.
If a malicious user can read your .bashrc and see your aliases,
then he might put malware called gizmo and gonzo in random directories
in the hopes that you will run it.
It’s better to make these use absolute pathnames:
alias gizmo='~/dev/myprog1/gizmo'
alias gonzo='~/dev/myprog2/gonzo'
By the way, you should avoid naming an executable test,
because that is a shell builtin command,
and you can run a program by that name
only by specifying a path or some other trick.
/is used extensively in Unix, largely as a directory separator. You are probably better off finding an easier way to type it. – chrylis 23 hours ago/is not difficult to type for the vast majority of people, and if OP has an injury which prevents this, they should consider alternate keyboard layouts, since there is no way they can avoid/completely while in the terminal. – JFA 13 hours ago