Wednesday, April 24, 2024
33
rated 0 times [  33] [ 0]  / answers: 1 / hits: 27422  / 3 Years ago, sun, september 5, 2021, 11:46:50

terminal



As you can see from the screenshot, my entire machine name (looks like a key) gets displayed whenever I invoke a terminal session.



Is there any way to avoid or hide it?


More From » command-line

 Answers
7

Yes. Open ~/.bashrc file from terminal with:



gedit ~/.bashrc


Find this line (in my case is somewhere at line 60):



PS1='${debian_chroot:+($debian_chroot)}[033[01;32m]u@h[033[00m]:[033[01;34m]w[033[00m]$ '


and replace it with:



PS1='${debian_chroot:+($debian_chroot)}[033[01;32m]u[033[00m]:[033[01;34m]w[033[00m]$ '


As you can see, the most important thing is to delete h (which stands for hostname) from PS1 if you want to hide machine name from displaying in terminal.



Save the file and close it. Restart the terminal, or just type:



. ~/.bashrc

[#29722] Tuesday, September 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afyess

Total Points: 437
Total Questions: 120
Total Answers: 107

Location: San Marino
Member since Fri, Jul 3, 2020
4 Years ago
afyess questions
;