People have suggested adding
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
by adding a line like
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
and it would run
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
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:
Or you can call the aliases
if you find that more intuitive.
Actually, this has, to an extent,
the same security risk as putting
. into your
If a malicious user can read your
.bashrc and see your aliases,
then he might put malware called
gonzo in random directories
in the hopes that you will run it.
It’s better to make these use absolute pathnames:
By the way, you should avoid naming an executable
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.