2

I want to hide username@solaris in a Unix shell.

I would like something like this:

$ ls -l

Instead I have this:

user@solaris:~$ ls -l

migrated from stackoverflow.com Oct 10 '11 at 18:11

This question came from our site for professional and enthusiast programmers.

  • 1
    This isn't a programming question – Chris Eberle Oct 10 '11 at 18:09
8

If by "something like" you mean: '$' when normal user, '#' when root then put

PS1=\$

in your .profile

Otherwise use

PS1=$
  • 1
    This makes a good point. You should use different prompts for root vs other users like CharString suggests. – chown Oct 10 '11 at 18:19
7

In /etc/bashrc or ~/.bashrc change the PS1 environment variable to PS1=$. Or add a new line if no PS1 already exists with:

PS1=$ 

Then, run this:

source /etc/bashrc

Or:

source ~/bashrc

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.