How To 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 username@localhost part in Terminal.
Hide “username@localhost:” Part In Terminal
Edit your “~/.bashrc” file:
Add the following at the end:
Type :wq to save and close the file.
Then, run the following command to take effect the changes.
That’s it. Now, check your Terminal. You will not see the username@localhost part. You will only see the ~> symbol.
Modify “username@localhost:” Part In Terminal
I don’t want to hide username@localhost 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:
Add the following line at the end:
Replace “ostechnix” with any letters of your choice. Type :wq to save and exit the file.
Run the following command to update the changes.
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 username@localhost part if you use single shell. Apart from hiding the username@localhost 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 user@example, or admin@demo. 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:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!