Is it possible to remove the device name in my shell commands to "save space"?

My-MacBook-Pro:~ username$


~ username$

Yes, BASH (the default OS X Shell) has the ability to customize the prompt in many ways.

$PS1 is the the shell variable for the main prompt.

Try typing echo $PS1 in the command line and it will show you how $PS1 is currently configured.

If you just want to remove the the host name you can set $PS1 to \W \u\$ (note there is a space after the $) (i.e.$PS1="\W \u\$ ")

If you want this to happen every time you login in you will need to add export $PS1="\W \u\$ " to your .bashrc file.

There is extensive information on setting the PS1 prompt with other options in the man bash page.

  • BTW the BASH manpage (man bash) is huge. If you want to go through it sensibly, type: man -t bash | open -f -a /Applications/Preview.app/. This opens a copy of the manpage in Preview (which you can then save as a pdf). – sdmeyers Aug 12 '14 at 14:31

Not the answer you're looking for? Browse other questions tagged .