Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I hide username and computer in terminal command prompt?

In Terminal it says

Last login: Mon Jan 13 00:00:14 on ttys000
Whatever:~ UserName$ 

Is it possible to show just the current folder and $ sign?

share|improve this question
What do you mean by show current folder? The current folder is already shown after the :. BTW: I've changed the computer name in System Preferences -> Sharing to MBP. Now my login prompt is very short: mbp:~ matt$ – gentmatt Dec 29 '11 at 7:27
up vote 34 down vote accepted

Change your prompt in your ~/.bashrc file. The example you asked for would be:

export PS1="\W \$"

It would result in the current folder you're in being shown plus a $ for the regular prompt and a # if you're root. Check out this guide for more examples of what you could show in your prompt.


As per one of the comments below, you might need to source your ~/.bashrc from your ~/.bash_profile or even put this code in your ~/.bash_profile instead. You can read this article for a better explanation on which file to use.

share|improve this answer
I have two questions since I have not that much experience working in the terminal :). 1) Why do you write ~/.bashrc? I found this file located at /private/bashrc. 2) I did not manage to edit the file because it is locked. I've tried changing permissions without success. – gentmatt Dec 29 '11 at 7:18
/etc/bashrc is the global file for all users, ~/.bashrcis your own. Definitions in your own overwrite whatever is defined in /etc/bashrc. – patrix Dec 29 '11 at 7:37
bashrc files are your bash resource files. Where you can customize the prompt, set aliases, export variables. Things of that nature. Like patrix said, the /etc/bashrc and the /private/bashrc files have system-wide resources. So somewhere in the /etc/bashrc is an export PS1 and if you edit your own bashrc file which is located at ~/.bashrc and export your own PS1 then on your account the command prompt will be different. If you want it changed for all users you have to edit the /etc/bashrc with a sudo command. – CaldwellYSR Dec 29 '11 at 17:28
for anyone still looking at this answer.. you may need to put it in ~/.bash_profile Then run "source ~/.bash_profile" or just open a new terminal. – Chris Aug 9 '14 at 0:38

Check out this tutorial on how to change your bash prompt. A very short version (only username and no current path): PS1="\u$ "

Result: myusername$ cat something.log

share|improve this answer
It works, now the problem is it will not save the new bash prompt. It will show the old one after i shut down my mac. Why? – DzulFriday May 15 '12 at 2:07
Did you put the variable in the following file: /Users/<yourusername>/.bash_profile? – timbooo May 15 '12 at 15:34
echo "export PS1='$ '" >> ~/.bash_profile
. ~/.bash_profile

This will leave just $ as a prompt. If you want to restore the old prompt, you will need to edit .bash_profile to remove that "export ..." line.

share|improve this answer

I had a similar issue with this but did not get it working at first.

This may of been because I wasn't sudo but either way this works just as well.

  1. Open the preferences in the terminal (top right)
  2. Then go into the shell tab
  3. Then copy/paste the command export PS1="\W \$"; clear;
  4. Then restart the terminal and should work

enter image description here

share|improve this answer
Best simple :). – Huynh Inc Jan 27 at 2:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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