Why does my Linux prompt show a $, instead of the login name and path?
Since you are asking two questions, I'll answer both.
Why doesn't tab autocomplete file paths?
Because you shell either doesn't support it, or tab completion isn't turned on.
To resolve this, you first need to discover what your shell is. On the machine whose shell you enjoy, run
echo $SHELL
You may see the common /bin/bash
, or something less common like /bin/tcsh
, /bin/zsh
or something else entirely.
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
which bash
This will give you the path of the shell you want, something like /bin/bash
, /usr/bin/bash
, or /usr/local/bin/bash
. Of course, if you want a shell other than bash, you'll say which tcsh
, which zsh
, or similar.
If you don't see a path, but instead see bash not found
, then you'll need to install the appropriate package, and again use which
to find out where the shell was installed.
With the path of your chosen shell, you can finally change your shell by running
chsh -s /bin/bash
replacing /bin/bash
with whatever the appropriate path for your shell of choice is.
Why is the prompt a dollar sign instead of [user@host path]?
Because of your prompt environment variables $PS1
, $PS2
, and so on. These things don't tend to be portable between shells, so here's a few links for likely candidates:
bash
has an extensive manual, with pages on Bash Variables (including PS1
, &c) and Printing a Prompt (which describes PROMPT_COMMAND
, the long name for PS1
). Add the following line to your ~/.bashrc
export PS1='[\u@\h \w] '
tcsh
has an online manual (just its man page), with a section on the prompt environment variables. Add the following line to your ~/.tcshrc
set prompt='[%n@%m %~] '
zsh
has a user guide, with a simple guide to prompts, as well as a manual, with a very detailed reference on Prompt Expansion. Add the following line to your ~/.zshrc
export PS1='[%n@%m %~] '
i guess, you are not using bash, but sh and your prompt is not set properly (if this is even possible with sh).
you can get your current shell by typing: echo $SHELL
if you want to start bash, just type bash
Bash is not the only shell.
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.
Bash uses gnu readline
for things like tab completion. This is a complicated subject and readline even has its own per-user config file.
See man bash
, man sh
, and man 3 readline
. Bash responds to --version
. On many linux systems, /bin/sh
is not actually bash, but usually a crippled version of ash
.
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.
Example: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html