How to fix my PS1 and after I messed it up [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 3 years ago.
Improve this question
I wanted to customize my terminal and one of the things I did was install zsh and made zsh my default shell (on iterm2).
Now I wanted to customize my ps1. Following online tutorials, I edited my ~/.bash_profile and added the line PS1 = "\h:\W"
Then I ran the command source ~/.bash_profile and now my terminal prompt starts with just "\h:\W". When in reality, I expected it to return "MyName: Current Directory"
I have no idea how to fix this. Editing my PS1 does not help the situation. Not sure why the backslashes haven't been working like in the PS1 guidelines I've found online.

From Customizing your shell prompt - For your user id and the current folder (and zsh)
PS1="%n:%/ "
on my mac that yields the prompt
efrisch:/Users/efrisch
I have no idea how to fix this You can also remove the line you added to your ~/.bash_profile and logout and back-in.

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)

Can I get (the new) bash on Windows 10 to load .profile [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 installed the new subsystem for Linux on Windows 10 (which comes with the Windows anniversary update), and started playing around with it.
What I noticed is that starting the shell (ubuntu bash) does not load .profile or .bash_profile, even though the .profile file exists. Is there a fix?
(And can someone with a lot of reputation make the windows-bash tag?)
By default, this release of Ubuntu-on-windows loads the file named .bashrc.
You can either put the script or add the below line to .bashrc (and create .bashrc if it is non-existent):
. ~/.profile
Note: If .bashrc is sourced from .profile, you may want to comment it out to prevent bash endlessly looping.

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.

Mac terminal -bash command not found? [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
I'm completely new to using terminal, and while trying to use brew to install some stuff, I did something to PATH. Now if I tell it to do something it always returns
-bash: blah: command not found.
Is there any way to reset something to fix this? What should I do?
Your path is usually set in either your .profile or .bashrc file. These are found in the root of your user's home directory.
You should be able to fix them by running these two commands in the terminal. They contain the default executable paths
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
You can set your path this way:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
and you can always add other directories if you want. Hope this helps.

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.

Resources