2

Recently, I have installed an application (gnuplot) under user directory (/home/usr/bin). I want to run the application whenever I type 'gnuplot' in any directory. What could I do?

I tried to set the path in ~/.cshrc by

setenv gnuplot /home/usr/bin/gnuplot

but it doesn't work. It reports "command not found" as I type gnuplot in the terminal.

  • /home/usr, really? That's insane. /usr/local or /opt/usr is where things like this should go. – Otheus Jun 2 '15 at 8:22
3

You should add this directory to the PATH variable. in C shell this can be done with command:

setenv PATH $PATH:/home/usr/bin
0

You have several choices. The first two options works only with one user. The third and fourth options works for all users.

Alias

Add this line in your .cshrc:
alias gnuplot '/home/usr/bin/gnuplot'


Update PATH

Add this line in your .cshrc:
setenv PATH $PATH:/home/usr/bin


Update /etc/csh.cshrc

The file /etc/csh.cshrc is read by all CSH instance. You can either create an alias, either update the $PATH environment variable. Same syntax as previous options.


Link to global path

Assuming all users have access to /usr/bin/, create a link to gnuplot:
$> ln -s /home/usr/bin/gnuplot /usr/bin/gnuplot

  • That $PATH should not include the gnuplot binary itself. – Kusalananda Jun 2 '15 at 7:32
  • 2
    On RedHat and Fedora systems and others, application-specific settings should/can be placed in /etc/profile.d, in this case, /etc/profile.d/gnuplot.csh and /etc/profile.d/gnuplot.sh – Otheus Jun 2 '15 at 8:41
  • @Pl4nk , what are the pros and cons of using Alias vs. adding the program's directory to your PATH? I have to do this for a bunch of utility commands, each in their own directory. – Winston Smith Nov 6 '15 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.