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
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
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.
If you are NOT using BASH but ZSH, do the following:
(2) add this line at the end of the file
export PS1="\$ ",
(3) save the file, ~/.zshrc,
(4) source the zshrc to apply the change with
(5) You should be good at this point!
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.
export PS1="\W \$"; clear;
Check out this tutorial on how to change your bash prompt.
A very short version (only username and no current path):
myusername$ cat something.log