How to show and access .bash_profile file from finder [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I was playing around with setting additional paths within .bash_profile. To see what would happen I did: export PATH="/Users/neil/blah" and purposefully did not include $PATH on the end of it. Now of course my path is broken, so when I go into terminal it won't let me type anything.
Basically what I need to do is find a way to access my .bash_profile file to fix it in (finder preferably), all without using terminal.
Any suggestion on how I can find and modify this hidden file without using terminal?
Thanks in advance!

PATH is only needed for lookups when you don't provide an absolute path. While
vi .bash_profile
might not work, because the shell doesn't know where vi is, the following would:
/usr/bin/vi .bash_profile
(Assuming the vi actually is in /usr/bin/).

Manually type the path ~/.bash_profile into any text editor, or tell finder to show hidden files and navigate there. Also if terminal is having problems you should still be able to ctrl-c out of the messages and cd around the use vim to fix it.

If you have admin privileges on the computer. Log in as a different user then rename or edit the .bash_profile with the bad PATH.

Related

How do you change the prompt of your terminal? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
right now my terminal reads Sean:~ A2014$ and I don't understand how to change it so it doesn't say Sean. Is there a general terminal name or are they relative based off of your system?
I'm presuming you're referring to the prompt? (Next to where you input commands in the terminal). If you want to change the title of the window, i think you can go to Shell>Edit title in the top bar while terminal is open.
On MacOS you should be able to edit/create a file in ~ (The home directory) called .bash_profile. In this file you can change (or add if it's not there) export PS1="{settings}" where {settings} is what will show up as the terminal prompt.
You can do this with a text editor like nano;
In a terminal you would type cd ~ and then
nano .bash_profile to create/edit it. Just make sure not to edit any PATH variables!
There are a bunch of bash prompt flags to display things like time and computer name you can look up, but you can just use plaintext as the prompt if you like. (A single $ is pretty common)

Bash Command Line: networksetup: Command Not Found (OS X) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
After editing my .bash_profile to export a path, my terminal stopped recognizing even simple commands such as "ls" and "vi".
The error message that I see is:
-bash: networksetup: command not found
I don't know if I caused this error by editing my .bash_profile, and since I haven't been able to open any files via the terminal, I can't delete what I last added.
Does anybody know how to fix this?
Use the command.
/usr/bin/vim .bash_profile
PATH variable defines the list of directories for where the executable for the given command will be searched for. Since the PATH variable is not set the system does not know where executable for the given commands (ls, vi, etc) are located
Update / Solution:
The problem was in the .bash_profile. I downloaded Secrets, which allowed me to see hidden files. With that, I could open my .bash_profile.

hidden autosave file error: no such file or directory [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I was editing an emacs file abc, and prior to saving, had a crash. There is now a file .#abc, and I would like to find out what is in that file, to perhaps recover what I was working on.
I know the file is there because when I type
ls -a
it lists
.#abc
However, when I type
more ".#abc"
or simply
more .#abc
I get the error
.#abc: No such file or directory
The same error occurs with cp in place of more.
How do I see what is in that file? Why does ls list it and then other commands can't find the file?
(Is .#abc actually an alias file? If so, how would I know that? And how, nevertheless, do I see the content of it, even if this is only what it is an alias to?)
[Note: I do not want to use emacs to try to find out what is in the file or restore it, because the situation is somewhat more complicated than described: the above is all occurring inside a Time Machine backup, which I need to access because of an emacs autosave overwrite problem on the primary file. I don't want to have the same problem occur on the backup of the autosave file!]
This is all on Mac OS10.8.4.
Whereas autosave files use a tilde ~, lock-files use a dot number-sign .#:
http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html
Creation of lock-files can be disabled with the following setting:
(setq create-lockfiles nil)
https://stackoverflow.com/a/12974060/2112489

Lost terminal PATH, cant use any commands or access directories [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I was trying to setting up Sublime text 2 for the terminal using this. It didn't work, and now the terminal cant access any directories or use simple commands like ls or cd.
Examples
$ ls
-bash: ls: No such file or directory
$ python
-bash: python: No such file or directory
I think my PATH is screwed up but i dont know how to fix it. Thanks in advance
Also if I echo $PATH, it is blank.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
This is a reasonable default. Run that at your terminal to fix that shell's path. Note that it won't affect other (future) shells.
You can run commands by typing their full path, e.g. /bin/ls. Use an editor this way to fix whichever startup file you messed up.

Mac / Unix: overwritten path variable [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I was starting to type the command export PATH=/newPathAddition:$PATH I think I must have copied in a newline when copying the newPathAddition to paste into the command, because it ran export PATH=/newPathAddition. I know I can manually add things to the path variable, but is there any way to restore it to what it used to be, or find out information about which directories were in the path beforehand? I really don't want to be in a situation in the future where all these commands aren't working on my computer because things vanished from the path that I don't remember.
These changes are local to this one command prompt. Just open another terminal window.
If you need the normal value of $PATH to use in this one specific terminal window, open another one and copy its $PATH value.
If you want changes to $PATH to persist, you need to write a .bashrc file or a .profile file in your home folder with the $PATH-altering commands you wish to use. To revert, take them out.

Resources