Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
I was trying to set python path,
and I think I accidentally misplaced an export command
currently my terminal begins like this
Last login: Mon Oct 2 16:28:18 on ttys000
-bash: export: `/abin': not a valid identifier
-bash: PYTHONPATH: command not found
export: Command not found.
export: Command not found.
can I get some help?
Can I reset the bash profile /profile/ bashrc to go back to the beginning?
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Quote:
Originally Posted by Kai Lee
Hi,
I was trying to set python path,
and I think I accidentally misplaced an export command
currently my terminal begins like this
Last login: Mon Oct 2 16:28:18 on ttys000
-bash: export: `/abin': not a valid identifier
-bash: PYTHONPATH: command not found
export: Command not found.
export: Command not found.
can I get some help?
Can I reset the bash profile /profile/ bashrc to go back to the beginning?
Unless you have made a backup copy of your bashrc file, the only other way I can think of to restore it would be;
Load/Install a copy of the *same* Linux distro into a virtual machine and copy the bashrc file from that, to your 'real' system.
Please just post a copy of your bash profile here using the CODE construct and we will certainly be able to help you better. Make sure you give precisions about the file. Is it the system-wide profile in /etc or is it your home profile?
-bash: indicates it is the login shell and that primarily reads .bash_profile if present, otherwise .profile.
Some Linux vendors put something in the system-wide /etc/profile that includes .bashrc, so this might be used secondary.
Last edited by MadeInGermany; 10-02-2017 at 05:15 AM.
Please just post a copy of your bash profile here using the CODE construct and we will certainly be able to help you better. Make sure you give precisions about the file. Is it the system-wide profile in /etc or is it your home profile?
I cannot open my bash_profile using nano command, and when I try to open on finder, it just shows few lines, which I don't think is the whole part
it only shows
if [-f ~/.bashrc]; then
source ~/.bashrc
fi
when I do echo $PATH it shows double path, like this
if you want to restore the "official" default - you may try to create another user and use that .bashrc.
But it looks like your PATH variable is not set properly, you need to fix only that.
Which file did you originally modify .bash_profile or .bashrc?
Obviously it depends on the distribution but your looks normal. Below is the default .bash_profile from CentOS. As posted the system wide defaults are located in /etc and user specific environment is defined in your ~/.bash_profile.
Without knowing exactly what you did to mess things up try logging out and back in.
Code:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
Which file did you originally modify .bash_profile or .bashrc?
that is the crucial question.
there's also a few more files that might be responsible, e.g. ~/.profile
and all 3 files mentioned have systemwide counterparts in /etc.
Hi again....have faith: the LQ'ers will 'get you there'; we just need to find out what got changed, out of the several files involved in logging-in. (Feel free to web-research for the sequence.) Which distro? MacOS?
IF your shell 'lost' its path, you can explicitly run cmds with their full path, like:
/usr/bin/nano (or /bin/cat; there's also sbin) (or maybe MacOS doesn't have nano)
If your internet is working, you can use that 'pipe to nc port 9999'
(cmd1;cmd2;...)|netcat termbin.com 9999, to just post 4char (link)
Those 'code' tags keep $:path :P smileys away. Unix is case-sensitive.
Look for relevant file that has: abin plus another 'typo' in it, around where ?you? (or py?) put abin (maybe; is abin a typo?)
Just want to point out that OP appears to be using a Mac/OS X. Granted, bash and these config files should work roughly the same way (I know they have for me), but for more specific support you might want to reach out to a Mac forum, or at the very least a BSD forum... just in case your problem has something to do with OS X and not bash specifically.
Normally your home bash_profile will be at ~/.bash_profile. As you see, from your investigation, it sources ~/.bashrc. So look in that direction. If .bashrc sources another script, follow the lead until you find out what line from which file specifically is breaking your PATH variable.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.