Click to See Complete Forum and Search --> : aliases for Programs


jefferso
04-16-2003, 11:22 AM
When you look at some commands in a shell you will see the following:

rdump -> ../usr/sbin/rdump

How can one change the path that the command looks to?

chrism01
04-16-2003, 11:35 AM
Sounds like you're on about symbolic
links. You can create link that looks like a program name and link it to the real prog you want to run. See the man page for 'ln'.
eg
ln -s realfile yoursymlink
enables you to refer to "realfile" using the name "yoursymlink".
Use
ls -l
to see that the first perm letter on a link is 'l' (lowercase L).

jefferso
04-16-2003, 11:46 AM
So let's say I have the following

command: netscape

Right now when you type netscape in it goes to /usr/sbin/netscape/netscape

Now if I want to have it go to /usr/lib/netscape/netscape I would type the following

ln netscape /usr/lib/netscape/netscape



Is this correct?

bwkaz
04-16-2003, 12:59 PM
Other way around. Notice -- it's target-filename first, and link-filename second.

And to do that (and have it work), you have to be in a directory that's currently in your PATH.

There is also a difference between aliases and links. If netscape is already an alias, then you also have to unalias netscape. Check your aliases by running just alias.

scinerd
04-16-2003, 01:12 PM
I would also allways use the -s option which is for symbolic links. Hard links can get you in trouble. I have had users delete files thinking they are local copies that turn out to be hard links.

bwkaz
04-16-2003, 05:53 PM
Huh? If you delete a hard link, then as long as the original is still linked into the filesystem somewhere, you won't lose the file...

[bilbo@beta temp]$ touch file
[bilbo@beta temp]$ ln file file2
[bilbo@beta temp]$ ls
file file2
[bilbo@beta temp]$ rm -f file2
[bilbo@beta temp]$ ls
file
[bilbo@beta temp]$ ln file file2
[bilbo@beta temp]$ rm -f file
[bilbo@beta temp]$ ls
file2 ln file file2 ; rm -f file does the exact same thing as mv file file2, by the way.