Linux: Curl installed but -bash: :curl: command not found

Chase Westlye picture Chase Westlye · Apr 9, 2019 · Viewed 12.9k times · Source

Running Debian Stretch on an r710. Using the non-free/contrib build for driver support.

When I try to use packages that I've installed (curl, zpool, etc), I have to include the path to the package... Which is a pain when I don't always know where packages install to.

Two questions:

  1. How do I remedy the path issue in the short term?
  2. How do I amend Debian so that when packages are installed, their paths update/install automatically?

Answer

wuseman picture wuseman · Apr 9, 2019

Find where the command is stored by

which <command>

Either you can try run curl from the output above for example /usr/bin/curl then try execute this:

 /usr/bin/curl

For a temporary fix until you solve the real problem you can do:

cd /usr/local/bin; ln -s $(which curl) curl

Or you can just set an alias:

echo "alias curl='$(which curl)'" >> ~/.bashrc; . ~/.bashrc

Troubleshoot your problem:

Check so PATH folder has the correct paths exported:

printf "%s\n" $PATH

Modify current PATH

Use the export command to add new paths and see if that works you can then update your ~/.bashrc or ~/.bash_profile, but first you can try in shell without adding it permanent to $PATH

export PATH=$PATH:/missed/bin/folder

To format your PATH variable for easy viewing in future you can add below function to your .bashrc

function path(){
    old=$IFS
    IFS=:
    printf "%s\n" $PATH
    IFS=$old
 }