How To Hide Or Modify “[email protected]:” Part In Terminal

Hide Or Modify "username@localhost:" Part In Terminal

Some people are privacy-obsessed and security paranoids. They always play safe. They never ever reveal a single identity of them in online. If you’re one of them, I do have a small tip to protect your privacy a little bit. If you’re a blogger or tech writer, there are chances that you need to upload the screenshots of your linux Terminal in your websites and blogs at times.  As you already know, the Linux Terminal reveals your username and hostname. Take a look at the following screenshot.

Here, sk is my username and ubuntuserver is my hostname.

Your username/hostname might be too cool, so you may not want others to copy and use them as their own. On the other hand, your username/hostname might be too weird or too bad or contains offensive characters, so you don’t want others to view them. In such cases, this small tip might help you to hide your [email protected] part in Terminal.

Hide “[email protected]:” Part In Terminal

Edit your “~/.bashrc” file:

vi ~/.bashrc

Add the following at the end:

PS1="\W> "

Type :wq to save and close the file.

Then, run the following command to take effect the changes.

source ~/.bashrc

That’s it. Now, check your Terminal. You will not see the [email protected] part. You will only see the ~> symbol.

Modify “[email protected]:” Part In Terminal

I don’t want to hide [email protected] part. Can I change it to something else? Of course, Yes! You can change your bash prompt to something cool and meaningful.

Edit ~/.bashrc  file:

vi ~/.bashrc

Add the following line at the end:

PS1="ostechnix> "

Replace “ostechnix” with any letters of your choice. Type :wq to save and exit the file.

Run the following command to update the changes.

source ~/.bashrc

Now, the BASH prompt will have the letters ostechnix in the shell prompt.

Warning: This is a bad practice in some cases. For example, if another shells like zsh inherits your current shell, it will cause some problems. Use it only for hiding or modifying your [email protected] part if you use single shell. Apart from hiding the [email protected] part in the Terminal, this tip is pretty useless and might be problematic.

Is there any other way?

Want to know another simplest way without messing the ~/.bashrc file? Just create another user account something like [email protected], or [email protected]. Use these accounts for making guides, videos and upload them on your blog or online. Now, you have nothing to worry about your identity.

Hope this helps. If you find our guides helpful. please spend a moment to share them on your social, professional networks, so everyone will get benefit from them.


Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.