Shell

davidson at freevolt.org davidson at freevolt.org
Tue Jun 30 15:10:26 UTC 2020


On Mon, 29 Jun 2020 Brandon helsley wrote:
>
>
> There has been a difference in the hash sign of the command
> line.

If by "hash sign" you mean the '#' character, then (by convention) no
non-root user should have such a prompt.

'#' is for root alone.

> When I'm logged in as user it is $.

This sounds like it could be a normal non-root user whose shell is
/bin/sh.

When logged in as that user, you can see what default shell they have
like so:

  $ finger `whoami`
  Login: poe            Name: little red riding hood
  Directory: /home/poe  Shell: /bin/sh
  [...]                 ^^^^^  ^^^^^^^

If the shell is /bin/sh, then the configuration file for that user's
shell is in ~/.shrc. You might be able to set the prompt to something
more helpful by uncommenting some lines in that file.

Uncomment these lines, for example:

  $ cat ~/.shrc
  [...]
  # # set prompt; ``username at hostname$ ''
  # PS1="`whoami`@`hostname | sed 's/\..*//'`"
  # case `id -u` in
  # 	 0) PS1="${PS1}# ";;
  #       *) PS1="${PS1}$ ";;
  # esac

When you've uncommented the lines, you can either log out and back in
again, or just do

  $ . ~/.shrc

to re-read the configuration, and hopefully see a prompt like

  poe at machine$

instead.

> When I am logged in as root it is #, even when I do not execute a
> shell.

Is it possible you booted into single-user mode? That is what I would
expect to see from /bin/sh in single-user mode.

After boot messages, did you see a query prompt like

   "Enter full pathname of shell or RETURN for /bin/sh:"

and then get your bare '#' prompt?

> Usually it was root at machine17#.
> How do I change it back?
> I have to do pwd instead of just knowing what directory I am in.


More information about the freebsd-questions mailing list