0

First I've installed curl:

company@rb-VirtualBox:~$ apt install curl
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

company@rb-VirtualBox:~$ sudo apt install curl
[sudo] password for company: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version (7.68.0-1ubuntu2.7).
0 upgraded, 0 newly installed, 0 to remove and 552 not upgraded.

Then I tried to use it:

company@rb-VirtualBox:~$ ​curl -X GET 'http://localhost:9200'

Command '​curl' not found, did you mean:

  command 'curl' from deb curl (7.68.0-1ubuntu2.7)

Try: apt install <deb name>

As you can see it still says "Command '​curl' not found".

If I execute it with the full path like this:

company@rb-VirtualBox:~$ /usr/bin/curl -X GET 'http://localhost:9200'

then it works


More Informations:

company@rb-VirtualBox:~$ whereis curl
curl: /usr/bin/curl /usr/share/man/man1/curl.1.gz

company@rb-VirtualBox:~$ echo $PATH
/home/company/.nvm/versions/node/v17.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
11
  • what if you try ​command curl -X GET 'http://localhost:9200' or \​curl -X GET 'http://localhost:9200'?
    – jesse_b
    Apr 5, 2022 at 13:57
  • For the first I get command: command not found, the second one throws the error Command '​curl' not found
    – Black
    Apr 5, 2022 at 13:58
  • What does type -a curl produce?
    – jesse_b
    Apr 5, 2022 at 13:59
  • curl is /usr/bin/curl
    – Black
    Apr 5, 2022 at 14:00
  • 2
    strange. I wonder if maybe there was some sort of special character involved when you first had the issue. If you copied that full command from somewhere maybe it had a \r or something in it.
    – jesse_b
    Apr 5, 2022 at 14:03

1 Answer 1

1

I don't know why, but after calling it with

company@rb-VirtualBox:~$ /usr/bin/curl -X GET 'http://localhost:9200'

now suddenly this works too:

company@rb-VirtualBox:~$ curl -X GET 'http://localhost:9200'

UPDATE:

As @jesse_b assumed correctly in the comments, it is because I copied the command from a website and some fishy characters like \r or \n where included, which were causing the error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .