Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have this in my ~/.bash_profile:

PATH=$PATH:~/Downloads/sublimetext
export PATH

But sublimetext in the folder isn't added to the path. Sublime Text gives this output when submitted to the file command:

sublime_text: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
share|improve this question
1  
can you show the output of: ps -p $$ | tail -1 | awk '{print $NF}', ls -lad ~/Downloads/sublimetext, and ls -la ~/Downloads/sublimetext/sublime_text? –  Christopher Neylan Feb 23 '12 at 23:17
    
It looks the problem here is that your PATH statements aren't sourced, so you need to make sure you do exactly that: source ~/.bash_profile and then look at echo $PATH. –  Herman Torjussen Feb 24 '12 at 17:49

4 Answers 4

up vote 3 down vote accepted

PATH contains directories, not executable files. Try PATH=$PATH:~/Downloads. Although, really, you shouldn't be putting your downloads directory in your path; move the executable somewhere appropriate. Make a ~/bin directory, for example.

share|improve this answer
    
I've moved sublimetext to ~/bin and added that to my path. Thing is sublime text is a directory, which contains the binary file sublime_text. So I am already referencing a directory in my path, not a directory. Nevertheless it won't come up when i try to execute it from the shell. –  fergusdawson Feb 23 '12 at 19:55
    
So, be more specific about "won't come up". Exactly what happens? Is there an error message? –  jjlin Feb 23 '12 at 21:14
    
what I meant by it was that it isn't included in the path. I get a standard 'cmd not found' error if I try to execute the program from outside the directory it's stored in. I'm definitely declaring it correctly in bash_profile because if I do the same thing with another executable (a python script for example) it works and I can call it from anywhere. So you can see from this that the problem isn't with the file not being executable, or not adding it to the path correctly. Hopefully I'm being clear enough. –  fergusdawson Feb 23 '12 at 23:09
    
It sounds like your PATH still isn't right, then. Can you update your question with the output of echo $PATH? –  jjlin Feb 24 '12 at 0:10

Is it set in permissions to be executable ? (chmod o+x ~/Downloads/sublimetext/sublime_text to make it)

share|improve this answer
    
I've been executing it with ./sublime_text so it is executable. I just tried your command and it didn't change anything. –  fergusdawson Feb 23 '12 at 20:14

It seems that you are modifying wrong .bash_profile. If you are root user then you have to modify /root/.bash_profile. Try sourcing as source /home/username/.bash_profile or source /root/.bash_profile and then check $PATH.

Please follow the summary at http://www.troubleshooters.com/linux/prepostpath.htm#_Summary

share|improve this answer

First off check if you should be using the 32-bit or 64-bit version.

Secondly create a shell script:

#!/bin/sh
# sublime shell script
# make sure there is no spaces in path.

if [ -d "$HOME/Downloads/SublimeText2" ] ; then
    PATH="$HOME/Downloads/SublimeText2:$PATH"
fi

sublime_text $@
#EOS

Now drop it in your ~/bin and make it executable.

$ chmod +x sublime

~/Desktop$ sublime -h | head -1

Sublime Text 2 Build 2181
share|improve this answer

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.