Path environment variable in console of Ubuntu 14.04 - path

This is what is appearing as soon as I open my terminal
bash: export:
`.rbenv/bin:/usr/local/play:/usr/local/jdk/bin:/usr/local/elasticsearch/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
export PATH=/home/rocio/
.rbenv/plugins/ruby-build/bin:/usr/local/play:/usr/local/jdk/bin:/usr/local/elasticsearch/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games':
not a valid identifier
bash: /usr/local/bin: Is a directory
bash: /home/rocio/usr/local/bin: No such file or directory
bash: /home/rocio/usr/bin: No such file or directory
bash: /usr/bin: Is a directory
bash: /usr/bin: Is a directory
bash: /usr/bin/: Is a directory
bash: /usr/bin/ls: No such file or directory
bash: /bin: Is a directory
bash: /bin: Is a directory
bash: /usr/bin: Is a directory
bash: /usr/bin: Is a directory
bash: /bin: Is a directory
bash: /usr/bin: Is a directory
bash: /usr/bin: Is a directory
bash: /bin: Is a directory
bash: /usr/bin: Is a directory
bash: /bin: Is a directory
I'm not able to use clear or ls or sudo commands
It says, they are in /usr/bin or /bin. These are not in your path. So cannot run those commands.
Can anyone help me how to resolve this issue.
Thanks in advance

It looks as if you edited your shell initialization files, and introduced a syntax error in the assignments for setting PATH. If that is only the files in your home directory (versus editing /etc/profile, etc), you can recover by renaming your files, closing the shell (with control/D) and then starting the terminal again.
Most Ubuntu users are using bash, whose name-completion probably still works with this problem.
To rename, use the full path of mv, e.g.,
for n in .inputrc .bashrc .bash_profile .profile; do /bin/mv $n $n.orig;done

I was able to resolve the problem. I added some of those commands unknowingly into bashrc file in the home directory. I just had to delete those extra commands in the file. Everything was running fine again.
So, in order to resolve any such issues. Check your bashrc file. As your console first runs that file before starting.
Thank you.

Related

root directory empty no folders on digitalocean

when i connect remotely to digital ocean server by doing ssh deploy#dropletIP i type pwd this comes out
/home/deploy
when i type "ls" nothing show up
when I do cd shared it says
-bash: cd: shared: No such file or directory
when i type .. or cd - or /
No command 'cd-' found, did you mean:
..: command not found
-bash: /: Is a directory
Im trying to navigate to shared/config so i can create database.yml and secrets.yml
cause you logged in to ur remote server as SFTP, that will make u go to different directory than logging in as SSH

-bash: cd: supbot-tut: No such file or directory

I opened terminal fresh and typed.
$ python3
Then I typed quit to get out of it.
$ quit()
I then typed:
$ pip3 install splinter requests bs4
After I typed:
$ cd supbot-tut
-bash: cd: supbot-tut: No such file or directory
When I typed that I got the error code: -bash: cd: supbot-tut: No such file or directory.
I tried this dozens of times and it won't work. I do not know how to fix this problem and I am a new coder so please send exact code I have to write to fix this problem. Thank you!
Check if you're in the correct directory using pwd and see if that directory contains supbot-tut that you're trying to get into with ls.
Or you can make a directory using mkdir supbot-tut then you will be able to cd into it.
That error occurs when you try to issue the cd command and you pass a directory (a folder) that doesn't exist. Can you type the command ls and see if you see that directory listed. You can easily check with your file explorer too. Create that directory and your issue should go away.

Extend $PATH variable in git bash under Windows

I'm trying to extend my $PATH variable in git bash (MinGW shell) by adding the following to the file ~/.bashrc
PATH=$PATH':/c/Program Files/maven/apache-maven-3.2.5/bin'
After I did this and restarted the bash it seems like that the $PATH variable was extended like expected:
$ echo $PATH
MANY_OTHER_PATHS:/c/Program Files/maven/apache-maven-3.2.5/bin
But I still cannot execute the programms in the given directory:
$ mvn
bash: mvn: command not found
What went wrong here? How do I extend the PATH variable correctly?
Here are two ideas.
You can have your path with double quote mark.
export PATH=$PATH:"/C/Program Files (x86)/apache-maven-3.3.3/bin"
Or, You can also make symbolic link for the directory.
ln -s "/C/Program Files (x86)/apache-maven-3.3.3/bin" ./mvnbin
export PATH=$PATH:/your-path/mvnbin
It works for me in mingw32 environment.
I needed to add something to my Git Bash path permanently each time I open it. It was Meld.exe path which can be added with:
export PATH=$PATH:"/C/Program Files (x86)/Meld/lib"
In order to execute this command each bash session, you need a ~/.bashrc file. Check if it already exists or create it using notepad ~/.bashrc or touch ~/.bashrc.
You can check where it is with:
echo ~
Open it and add the command that adds the PATH (first command in this response).
I hope you found this useful.
According to this SO post, you need to escape Program Files with quotes. git-bash $PATH cannot parse windows directory with space
Add PATH in Git Bash Permanently | Windows Only
Just in case you are still wondering how to add a path permanently in git bash here is the step-by-step process for Windows users:
Create .bashrc in user's root folder using the below command. It will open notepad and ask you to create the file, click yes.
notepad ~/.bashrc
Put the directory you want to add as below, for more than 1 items repeat the same format in next line:
export PATH=$PATH:"/c/folder/folder/"
Save the file and relaunch the bash.
Next launch will give you a warning like WARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile. but git bash will handle it by creating the required files.
SOME INSIGHTS
Git Bash doesn't fetch Window's environment PATH, it maintains its PATH separately in more like a Linux way.
You can run export PATH=$PATH:"/c/folder/folder/" in cmd to add a directory to path, but it will be only for the current session once you close the bash, it will be gone.
.bashrc is a shell script file that will be executed every time you launch a new git bash window. So you can add any type of bash command here. We simply added the export command to add our desired directory to PATH.

Creating a symbolic link to Sublime Text2

I am installing software on my MacBook Pro in preparation for a Rails tutorial. One of the steps involves creating a symbolic link to Sublime Text 2 so that it can be used in Bash. To do this, Sublime Text advises
The first task is to make a symlink to subl. Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
When I run this command, I get
ln: /Users/nngrey/bin/subl: No such file or directory
My path seems to include ~/bin:
echo $PATH
/Users/nngrey/.rvm/gems/ruby-2.0.0-p247#railstutorial_rails_4_0/bin:/Users/nngrey/.rvm/gems/ruby-2.0.0-p247#global/bin:/Users/nngrey/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/nngrey/.rvm/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
Any suggestions?
Thanks
Your $PATH does not, in fact, contain ~/bin. If you look closely, /Users/nngrey/bin is not there. The original ln -s ... command probably failed because ~/bin doesn't exist. To make it, run mkdir ~/bin from Terminal. Then, rerun the ln command. Finally, run ~/bin/subl ~/.profile to open your ~/.profile file in Sublime, and add the following line to the bottom:
export PATH=$PATH:~/bin
Save the file, then restart your Terminal session and you should be able to type subl filename from the command line in any directory.

Having trouble running "mate .rspec"

I'm trying to run mate .rspec in my command prompt in order to open the .rspec configuration file. However, I get the error -bash: mate: command not found. Any ideas?
Though Brandon's answer is correct, there's a far simpler way to set up the mate command through TextMate itself.
In the menu bar, select Help > Terminal Usage..., choose /usr/bin from the dropdown, and it will create the link for you.
You might have to open a new Terminal window for it to take effect, but then you should be all set.
[Update]
T.J.'s answer is much better than mine. :)
[Original Answer]
TextMate installs the mate command to /usr/local/bin/mate. First, I would check to see if the mate command is in that directory:
ls -lah /usr/local/bin/mate
If you get ls: /usr/local/bin/mate: No such file or directory, then you can install the mate command by creating a symbolic link to the binary, which lives in the TextMate.app folder:
sudo ln -s /Applications/TextMate.app/Contents/Resources/mate /usr/local/bin/mate
At this point, you should be able to run mate from the command line.
If you got output other than No such file or directory from the ls command, it means that /usr/local/bin is not on your path.

Resources