Wrong executable path for python in linux - linux

In linux bash, I need to run an application (HTSeq) which uses python. When I run the command I get this error:
-bash: /app/HTSeq-0.5.3p7/bin/htseq-count: /usr/bin/python26: bad interpreter: No such file or directory
The thing is that I do not have "python26" in my executable path. So in my /usr/bin/ path I have followings:
/usr/bin/python2.6
/usr/bin/python
I think sometimes I have manually changed something incorrectly. But how can I fix it?
Thanks in advance.

Try renaming "python2.6" to "python26" with sudo mv /usr/bin/python2.6 /usr/bin/python26

Well, since you don't have sudo rights, you could try this:
First create a symlink,
ln -s /usr/bin/python2.6 ~/Desktop/python26
and then adding the symlink dir to your PATH variable
export PATH=$PATH:/home/<your account>/Desktop

Related

What does "sudo ./xampp-linux-x64-5.6.3-0-installer.run" do?

I know what sudo does I just have no idea what "./" does I have done a bunch of research and have come up empty. What does this the “./” do in “sudo ./xampp-linux-x64-5.6.3-0-installer.run” do in the Linux terminal?
. means current directory
./xampp-linux-x64-5.6.3-0-installer.run means you are trying execute the executable xampp-linux-x64-5.6.3-0-installer.run from current directory
sudo ./xampp-linux-x64-5.6.3-0-installer.run
means you are trying to run the executable from current directory using root previlege

Path, /usr/bin/ and /usr/local/bin/

I installed watchr on OS X (10.8.3) using gem install watchr. And it's installed in /usr/bin/watchr
$ which watchr
/usr/bin/watchr
However, when I tried to call it $ watchr -v, the system couldn't find it.
$ watchr -v
-bash: /usr/local/bin/watchr: No such file or directory
I think this is related to how the path is set up on my machine. My questions:
What is the right way to fix it?
In general, what programs should go to /usr/bin/ vs. /usr/local/bin/?
When I do e.g. $ /usr/bin/watchr -e 'watch(./hello.txt) ...', are we looking at the hello.txt in the current directory or in /usr/bin/ i.e. the same directory as watchr?
The path to your command was cached with a bad value. Try to update the cached directory that bash has stored for the path.
hash -d watchr
I found the answer over here which ctags shows /usr/local/bin/ctags but when I run ctags it runs /usr/bin/ctags. How is this possible?
Is /usr/local/bin/watchr a broken symlink? That would make which watchr not include it but watchr would print this error:
-bash: /usr/local/bin/watchr: No such file or directory
I don't know why the gem that comes with OS X installs programs in /usr/bin/, but generally /usr/bin/ is meant for preinstalled programs, and package managers use something like /opt/local/bin/ or /usr/local/bin/.
I also have /usr/local/bin/ before other folders on the path, and I put most programs that I install or compile manually to /usr/local/bin/. I used to have a separate ~/bin/ folder, but it's easy to find non-Homebrew programs with something like find /usr/local/bin ! -lname '../Cellar/*'.
Related questions about /usr/local/bin/ in general:
https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux
https://unix.stackexchange.com/questions/4186/what-is-usr-local-bin-came-across-it-in-an-script-installation-for-applescript
create a file called .profile in your home directory and add the following line.
export PATH=“/usr/local/bin:/usr/local/sbin:/usr/bin:$PATH”

command not found in bash-3.2$

I tried running a script file using bash but it showed an error
bash-3.2$ example.sh : command not found
I also tried
ls -l example.sh
I found that it was not executable, so I used
sudo chmod 777 example.sh
I again tried running it but same error was coming. I double checked that I am in the same folder as the file using ls. But still I am not able to execute the script file.
I finally tried making a dummy script file and running it , and found the same error
I think there is some problem with BASH. Can some one help me with what is the problem?
I am working on redhat, bash was already installed in my system
Since I am newbie on linux any help would be appreciated
bash search for commands in your $PATH. Apparently the current directory, ., is not in your $PATH. (This is a good thing; having . in your $PATH is insecure.)
You'll need to specify a directory name. Just type:
./example.sh
Incidentally, doing:
sudo chmod 777 example.sh
is two kinds of overkill. First, you don't need to use sudo; use sudo only when you actually need to. Presumably your personal account owns the file, so you can just use chmod directly.
Second, 777 is way too permissive. It allows anyone on the system to read, execute, or modify example.sh. (If you're the only person on the system it may not matter much, but it's still a bad habit.) Typically you should use 755 for directories and for files that need to be executable, and 644 for files that don't need to be executable.
Or just use
chmod +x example.sh
to set execute permission (your umask will prevent that from setting the permissions too loosely).
. (the current directory) is probably not on your path. Try ./example.sh or bash example.sh. You could also add . to your PATH environment variable, but that's generally frowned upon.
Your bash PATH probably doesn't include ., try running it by typing:
./example.sh
When you type a command, your shell searches your path to try to find the command, if the current directory (e.g. .) isn't part of the path, the script that you are trying to run won't be found. You'd have to explicitly give it the path to where this command is. And since it's in your current directory, you can just add ./ in front of the command.
first confirm the bash path
to check the path of bash use:
which bash
if you get "/bin/bash"
then add
#!/bin/bash
...
...
or whatever is the path on first line of your bash script

How can I prevent finding executable on $PATH?

I am using a system with an incomplete installation of GNAT, the GNU Ada compiler. A script (in the gdb testsuite) is finding /usr/bin/gnatmake and assumes that it can run Ada compiles. These fail because a the linker can't find libgnat.so.
I don't have root access, so I can't install libgnat.so or remove /usr/bin/gnatmake.
Is there any way to prevent a script from finding gnatmake in /usr/bin? I clearly cannot remove /usr/bin from the path.
Can you install a private, working version of gnatmake?
If you can, then you can create a symlink to the working version of gnatmake in your $HOME/bin directory:
ln -s /path/to/real/gnatmake ~/bin/gnatmake
Then insert your own $HOME/bin directory into your $PATH:
export PATH="$HOME/bin:$PATH"
Now the shell will find your version of gnatmake before the one in /usr/bin.
Try sudoing the script as yourself (sudo -u you ./script). In case you're not allow to sudo, you can also try exec VAR=val ./script. A third way would be to add another directory to $PATH with 'fake' empty scripts to shadow the ADA files.

Cannot execute bash script in redhat linux

I write a simple shell script to clean log files in redhat:
Filename: clean.sh
#!/bin/bash
rm -f *.log core.*
But when I typed clean or clean.sh, it always prompt
-bash: clean: command not found
-bash: clean.sh: command not found
What's the problem?
You probably don't have . (the current directory) in your $PATH (and that's a good thing; having . in your $PATH can be dangerous.)
Try this:
./clean.sh
And if the script file's name is clean.sh you can't run it as just clean, with or without a directory. The file name is clean.sh, and that's how you need to execute it.
Or you can change the name from clean.sh to just clean. Unix-like systems (that includes Linux) don't depend on file extensions the way Windows does.
problem 1: maybe the execute permission on clean.sh is not set. Do this:
chmod +x ./clean.sh
problem 2: RH Linux does not include CWD on the path by default. So, when you are in the same directory as clean.sh, type:
./clean.sh
That should execute it.

Resources