Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two executable files I downloaded and am trying to add to the path. They are located in

/home/user/folder

and the specific files are

/home/user/folder/app1
/home/user/folder/app2

Both app1 and app2 have the executable flag set to all (user, group, other).

I can execute the files if I am in /home/user/folder and I execute these commands

./app1
./app2

However I can't run them from elsewhere. I added this line to my .profile

PATH="$PATH:/home/user/folder"

and then sourced the path with

. /home/user/.profile

and I can see app1 and app2 when I use command completion (pressing tab). However here is what happens when I try to run app1 or app2 with the following commands (the following only shows 'app1' but the same is true of 'app2')

user@comp:~$ app1
-bash: app1: command not found
user@comp:~$ /home/user/folder/app1 
-bash: app1: command not found
user@comp:~/folder$ ./app1
(program runs)

I'm stumped :), I must have missed something simple. Thanks for your help!!

UPDATE

Ok, I found some errors in the path which I think I fixed, but now it's not running in any case - which for some reason I think is a step forward. Thanks for suggesting the following steps, here is their output:

user@computer:~$ echo $PATH
/usr/share/fsl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/matlab/bin:/usr/local/VoxBo/bin:/usr/local/itt/idl64/bin:/usr/local/afni/bin/:/usr/local/mricron:/usr/lib/voxbo/bin:/home/user/folder:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11/:/usr/games/:/usr/local/matlab/bin:/usr/local/VoxBo/bin/:/usr/local/itt/idl64/bin:/usr/local/afni/bin/:/usr/local/mricron/
user@computer:~$ typeset -p PATH
declare -x PATH="/usr/share/fsl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/matlab/bin:/usr/local/VoxBo/bin:/usr/local/itt/idl64/bin:/usr/local/afni/bin/:/usr/local/mricron:/usr/lib/voxbo/bin:/home/user/folder:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11/:/usr/games/:/usr/local/matlab/bin:/usr/local/VoxBo/bin/:/usr/local/itt/idl64/bin:/usr/local/afni/bin/:/usr/local/mricron/"
user@computer:~$ type app1
app1 is /home/user/folder/app1
user@computer:~$ type app2
app2 is /home/user/folder/app2
user@computer:~$ app1
bash: /home/user/folder/app1: No such file or directory
user@computer:~$ app2
bash: /home/user/folder/app2: No such file or directory
user@computer:~$ /home/user/folder/app1
bash: /home/user/folder/app1: No such file or directory
user@computer:~$ /home/user/folder/app2
bash: /home/user/folder/app2: No such file or directory
user@computer:~$ cd /home/user/folder
user@computer:~/folder$ app1
bash: /home/user/folder/app1: No such file or directory
user@computer:~/folder$ ./app1
bash: ./app1: No such file or directory
user@computer:~/folder$ ./app2
bash: ./app2: No such file or directory
user@computer:~/folder$ ls -l
total 29384
-rwxr-xr-x 1 user user 14949776 2011-02-03 11:09 app1
-rwxr-xr-x 1 user user 15137300 2011-02-03 11:10 app2
user@computer:~/folder$

Thanks for everyone's input!

share|improve this question
1  
What does type app1 app2 output? What do you mean by /somedir/app1? wasn't app1 in /home/user/folder? –  geirha Feb 3 '11 at 22:05
    
@geirha by 'somedir' I ment a directory other than /home/user/folder. type app1 and type app2 returns the following: app1 is a hash (/home/user/folder/app1) and app2 is /home/user/folder/app2. Thanks! –  Evan Feb 3 '11 at 22:09
    
What is gdw? Is it app1 or something else? –  Mikel Feb 3 '11 at 22:14
    
@Mikel yeah app1 is actually gdw which is used by a program called voxbo :) - sorry about the typo! In my last comment 'gdw' should be app1. (should be fixed) –  Evan Feb 3 '11 at 22:23
2  
Please re-run your tests, but first run echo $PATH, typeset -p PATH, and type app1 in the same terminal, and paste the output of those as well as app1, /home/user/folder/app1, cd, and ./app1. –  Mikel Feb 3 '11 at 22:39

1 Answer 1

up vote 2 down vote accepted

I know some of this is repetitive.... but...

Edit your BASH RC file:

vim ~/.bashrc

Export the PATH:

export PATH=$PATH:/home/$username/folder/

If you don't want to log in again to get the path, SOURCE it:

source ~/.bashrc

Make sure the file is yours and executable:

chown -R $username /home/$username/folder/
chmod +x /home/$username/folder/app*

Try to run:

cd
app1
app2

Still have the command not found error? Well, what kind of files are app1 and app2?

file /home/$username/folder/app1
file /home/$username/folder/app2

If they are text files, it could be that they are scripts, like BASH or Python. If so, open them up with an editor to see if you can glean the source of the problem. If you paste any of the contents of the text files (if, indeed, they are text files), be sure to please include the very first line - the "file magic" like #!/bin/sh, for example.

share|improve this answer
    
I think the 'file app1' command did the trick. The file is a ELF 32 bit LSB executable and I'm using a 64bit Ubuntu box. I think that's probably the problem? –  Evan Feb 4 '11 at 1:42
1  
Oh! So... Does 'getlibs' solve the problem? ubuntuforums.org/showthread.php?t=474790 –  user8290 Feb 4 '11 at 1:49
    
WOW! Worked like a charm. Thanks so much your help! –  Evan Feb 4 '11 at 2:01
    
@Evan. Ah, if you had said the error message was No such file or directory from the start, instead of command not found, which is a completely different error message, that'd be my first guess. So you did accidentally omit vital information by censoring the filenames. –  geirha Feb 4 '11 at 2:54
    
@geirha sorry about that, the whole thing confused the heck out me because I knew it had to be something simple in the end. I actually ran the second set of tests (the output I added in the update) after a reinstall so both of us wish I had a clearer picture sooner :). Good old computers... –  Evan Feb 4 '11 at 6:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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