LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   "Command not found" no matter full path or relative or none yet... (https://www.linuxquestions.org/questions/linux-software-2/command-not-found-no-matter-full-path-or-relative-or-none-yet-4175609368/)

FoxtrotLima 07-07-2017 06:17 AM

"Command not found" no matter full path or relative or none yet...
 
Is there something special about /usr/local/bin.

This happens both with scripts and binary executables.
I can ls, and "which" and "whereis" show me the exe file but when I try to run it says "Command not found". I have done "rehash" and also logged out and back in.

A binary exectuable called for example "sr" gets this:

# sr ls
sr: Command not found.
# ./sr ls
sr: Command not found.
# ls sr
sr
# whereis sr
sr: /usr/local/bin/sr
# which sr
/usr/local/bin/sr
# /usr/local/bin/sr ls
/usr/local/bin/sr: Command not found.

I also made a simple csh script in the same dir, that just echos "this is here" to the screen. it acted normally, where it was "not found" but I could call it with ./ prefix, and after I did a "rehash" could just call it. Also /usr/local/bin is first in my PATH.

Anyone run into this before?

hydrurga 07-07-2017 06:28 AM

Could you please do a:

ls -ld /usr/local/bin/sr

Also, purely to check:

echo $PATH

Just a note that, in your examples, you should show which current working directory you're calling the various commands from.

pan64 07-07-2017 06:48 AM

additionally:
file /usr/local/bin/sr
and
head /usr/local/bin/sr
if that was a readable text file.

rtmistler 07-07-2017 06:48 AM

Any particular reason you are the root user here?

There is nothing more special about /usr/local/bin than any other directory.

I also would like to see the output of the ls -ld command hydrurga has asked you for and your $PATH variable in support of your comment that /usr/local/bin is in your path.

Seeing the long listing of that file will tell us who owns it, what group it is in, and what the files privileges are.

BW-userx 07-07-2017 07:25 AM

yeah I've had this happen to me with something else - it was there but when ever I tried to use it - it'd tell me the same thing, I did the same searches you did seeing it was there then I just got tired of trying to figure out why it would still not work and just reinstalled it. that fixed that problame toot sweet. ;) someone than suggested after I did this to check it with stat. but it was too late by then.

FoxtrotLima 07-07-2017 08:54 AM

Quote:

Originally Posted by hydrurga (Post 5731823)
Could you please do a:

ls -ld /usr/local/bin/sr

Also, purely to check:

echo $PATH

Just a note that, in your examples, you should show which current working directory you're calling the various commands from.

Sorry, I am used to a prompt that does show it but I was in /usr/local/bin.

I was root because there was a need to be for the work I am doing.

I'm on my way out and it is on a different machine that isn't connected to the internet, so please take my word for it, FIRST in my path is (spelled correctly) /usr/local/bin

Besides, it is a moot point. I can see the command. As I said if I call it with full pathname it still doesn't use it. "sr" is a binary executable. I'm having the same thing with scripts as well.

hydrurga 07-07-2017 08:58 AM

Quote:

Originally Posted by FoxtrotLima (Post 5731896)
Sorry, I am used to a prompt that does show it but I was in /usr/local/bin.

I was root because there was a need to be for the work I am doing.

I'm on my way out and it is on a different machine that isn't connected to the internet, so please take my word for it, FIRST in my path is (spelled correctly) /usr/local/bin

Besides, it is a moot point. I can see the command. As I said if I call it with full pathname it still doesn't use it. "sr" is a binary executable. I'm having the same thing with scripts as well.

With all due respect, you were able to paste (or at least copy) output from that machine before on to this forum.

I and pan64 have both asked you to provide output from various commands in order to troubleshoot. You might also add the stat command implied by BW-userx's post. If you won't help us, we can't help you.

rtmistler 07-07-2017 09:35 AM

Once again, some important ls -l information would be file ownership and permissions.

It is very common for any or all of us, including yourself, to have something unexplained hit us, and then we have a viola moment where we realize we overlooked something.

Therefore when you have the time to look further into this, perhaps you can check this information.

We do understand that you cited other applications or scripts. Therefore perhaps something changed to the permissions or ownership of the /usr, /usr/local, or /usr/local/bin trees. I would check those as well.

scasey 07-07-2017 11:06 AM

*nix systems are intentionally vague about permission errors. They use "file not found" or "command not found" when the user doesn't have permissions, which is why we're asking to see ls -l...it will show us the permissions.

A point of experience: I always use ls -l to look at files. A simple ls tells me nothing about the file other than it appears to be there (it could, for example, be a link to another file that is not executable -- something I'd never know unless I did a long listing)

frankbell 07-07-2017 07:08 PM

Quote:

A binary executable called for example "sr" gets this
Is sr the command or it merely a random string of letters? A web search turns up no reference to an "sr" command.


All times are GMT -5. The time now is 04:16 PM.