How to change a program path/alias?

1

1

I'm not sure how it works on Linux, but you can type in program names such as ls, man, etc., in any directory and the programs are executed.

I uninstalled an old version of ImageMagick and built the new version, and now when I try executing the convert command (which runs ImageMagick) I get the following error:

/usr/bin/convert: No such file or directory

So I ran:

find / -name convert

Which showed this:

/usr/local/bin/convert

So it appears that for some reason ImageMagick put the actual executable in a different directory this time around, but when I try running the program it looks in the old directory.

How can I update the convert path/alias/shortcut (terminology fail) with the new path?

Nate

Posted 2014-11-29T03:15:13.433

Reputation: 1 125

You could try making a symbolic link between the new path and the old path. This feels like a bit of a hack, but it's probably less likely to break things than attempting a move.

Alternatively you could look at build options for ImageMagick and see if there's a path you can change when building – Crippledsmurf – 2014-11-29T03:23:25.480

Put /usr/local/bin in your path? – DavidPostill – 2014-11-29T08:33:36.070

@DavidPostill You mean the $PATH variable? If so, it's already in there: /usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin – Nate – 2014-11-29T14:39:50.937

1What is the output of ls -al /usr/local/bin/convert? and what is the output of alias? – DavidPostill – 2014-11-29T16:23:24.217

@DavidPostill The output of that command is -rwxr-xr-x 1 root root 24743 Nov 28 21:57 /usr/local/bin/convert*. The output of alias is quite long, but there's nothing for convert in it. – Nate – 2014-11-30T16:46:39.800

@Crippledsmurf From this post, http://www.imagemagick.org/discourse-server/viewtopic.php?t=15598#p55366, it appears /usr/local/bin is actually the "right" location for the convert program.

– Nate – 2014-11-30T16:54:10.180

Answers

1

You should make sure that your /usr/local/bin/ directory is in your $PATH:

echo $PATH

This should return all directories where your Bash searches for executables, separated by colons (":"). The output should look similar to this:

/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin

The Bash shell uses 'hash table' to remember the full pathnames of executable files. For details see man bash and search for 'SHELL BUILTIN COMMANDS'.

It may happen that after a new installation of programs, that this hash table is not updated automatically. To enforce this update in the current terminal, use this command:

hash -r

Now which convert

should return

/usr/local/bin/convert

Kurt Pfeifle

Posted 2014-11-29T03:15:13.433

Reputation: 10 024