Why does my Linux prompt show a $, instead of the login name and path? - Super User most recent 30 from superuser.com2010-03-18T08:27:35Zhttp://superuser.com/feeds/question/68397http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://superuser.com/questions/68397/why-does-my-linux-prompt-show-a-instead-of-the-login-name-and-path0Why does my Linux prompt show a $, instead of the login name and path?Alexhttp://superuser.com/users/132012009-11-10T09:46:04Z2009-11-10T15:12:12Z
<p>On one of my servers, the prompt is [user@host path]...and I can actually push "tab" to auto-fill the path.</p>
<p>But on my new Ubuntu server, it is just a dollar sign?</p>
http://superuser.com/questions/68397/why-does-my-linux-prompt-show-a-instead-of-the-login-name-and-path/68398#683982Answer by Palantir for Why does my Linux prompt show a $, instead of the login name and path?Palantirhttp://superuser.com/users/163822009-11-10T09:47:52Z2009-11-10T09:48:19Z<p>You need to set a variable called PS1 on one of your login script, for example /etc/profile or ~/.bashrc. It will depend on your distribution. </p>
<p>Example: <a href="http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html" rel="nofollow">http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html</a></p>
http://superuser.com/questions/68397/why-does-my-linux-prompt-show-a-instead-of-the-login-name-and-path/68399#683992Answer by knittl for Why does my Linux prompt show a $, instead of the login name and path?knittlhttp://superuser.com/users/37732009-11-10T09:48:09Z2009-11-10T09:48:19Z<p>i guess, you are not using bash, but sh and your prompt is not set properly (if this is even possible with sh).</p>
<p>you can get your current shell by typing: <code>echo $SHELL</code></p>
<p>if you want to start bash, just type <code>bash</code></p>
http://superuser.com/questions/68397/why-does-my-linux-prompt-show-a-instead-of-the-login-name-and-path/68401#684014Answer by DigitalRoss for Why does my Linux prompt show a $, instead of the login name and path?DigitalRosshttp://superuser.com/users/91542009-11-10T09:59:28Z2009-11-10T09:59:28Z<p>Bash is not the only shell.</p>
<p>Your issue could be a simple matter of not having a .profile or .bashrc that sets PS1, or it could be that your login shell is not bash at all.</p>
<p>Bash uses <code>gnu readline</code> for things like tab completion. This is a complicated subject and readline even has its own per-user config file. </p>
<p>See <code>man bash</code>, <code>man sh</code>, and <code>man 3 readline</code>. Bash responds to <code>--version</code>. On many linux systems, <code>/bin/sh</code> is not actually bash, but usually a crippled version of <code>ash</code>.</p>
http://superuser.com/questions/68397/why-does-my-linux-prompt-show-a-instead-of-the-login-name-and-path/68486#684865Answer by Joseph Holsten for Why does my Linux prompt show a $, instead of the login name and path?Joseph Holstenhttp://superuser.com/users/83692009-11-10T15:12:12Z2009-11-10T15:12:12Z<p>Since you are asking two questions, I'll answer both.</p>
<h3>Why doesn't tab autocomplete file paths?</h3>
<p>Because you shell either doesn't support it, or tab completion isn't turned on.</p>
<p>To resolve this, you first need to discover what your shell is. On the machine whose shell you enjoy, run</p>
<pre><code>echo $SHELL
</code></pre>
<p>You may see the common <code>/bin/bash</code>, or something less common like <code>/bin/tcsh</code>, <code>/bin/zsh</code> or something else entirely.</p>
<p>Now, you can change your shell on Ubuntu machine. On that machine, first make sure that the shell you want exists. Since the shell might not be in the same location on the Ubuntu machine as on the other, check the location by typing</p>
<pre><code> which bash
</code></pre>
<p>This will give you the path of the shell you want, something like <code>/bin/bash</code>, <code>/usr/bin/bash</code>, or <code>/usr/local/bin/bash</code>. Of course, if you want a shell other than bash, you'll say <code>which tcsh</code>, <code>which zsh</code>, or similar.</p>
<p>If you don't see a path, but instead see <code>bash not found</code>, then you'll need to install the appropriate package, and again use <code>which</code> to find out where the shell was installed.</p>
<p>With the path of your chosen shell, you can finally change your shell by running</p>
<pre><code>chsh -s /bin/bash
</code></pre>
<p>replacing <code>/bin/bash</code> with whatever the appropriate path for your shell of choice is.</p>
<h3>Why is the prompt a dollar sign instead of [user@host path]?</h3>
<p>Because of your prompt environment variables <code>$PS1</code>, <code>$PS2</code>, and so on. These things don't tend to be portable between shells, so here's a few links for likely candidates:</p>
<p><code>bash</code> has an <a href="http://www.gnu.org/software/bash/manual/" rel="nofollow">extensive manual</a>, with pages on <a href="http://www.gnu.org/software/bash/manual/html%5Fnode/Bash-Variables.html" rel="nofollow">Bash Variables</a> (including <code>PS1</code>, &c) and <a href="http://www.gnu.org/software/bash/manual/html%5Fnode/Printing-a-Prompt.html" rel="nofollow">Printing a Prompt</a> (which describes <code>PROMPT_COMMAND</code>, the long name for <code>PS1</code>). Add the following line to your <code>~/.bashrc</code></p>
<pre><code>export PS1='[\u@\h \w] '
</code></pre>
<p><code>tcsh</code> has an <a href="http://www.tcsh.org/tcsh.html/" rel="nofollow">online manual</a> (just its man page), with a section on the <a href="http://www.tcsh.org/tcsh.html/Special%5Fshell%5Fvariables.html#prompt" rel="nofollow">prompt</a> environment variables. Add the following line to your <code>~/.tcshrc</code></p>
<pre><code>set prompt='[%n@%m %~] '
</code></pre>
<p><code>zsh</code> has a <a href="http://zsh.sourceforge.net/Guide/zshguide.html" rel="nofollow">user guide</a>, with a <a href="http://zsh.sourceforge.net/Guide/zshguide02.html#l19" rel="nofollow">simple guide to prompts</a>, as well as a <a href="http://zsh.sourceforge.net/Doc/Release/zsh.html" rel="nofollow">manual</a>, with a very detailed reference on <a href="http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html" rel="nofollow">Prompt Expansion</a>. Add the following line to your <code>~/.zshrc</code></p>
<pre><code>export PS1='[%n@%m %~] '
</code></pre>