Is there a way I can hide the hostname on the terminal without updating the /etc/hosts
or related files.
Generally we see the server details on screen as below
[root@ServernamE /]#
So, I don't want the hostname = ServernamE to be displayed on terminal. The reason for doing this is, I will be recording a web session. I know that I can morph the desired part but that is time consuming and depend on other softwares.
Thanks
If you want a temporary solution(since you are talking about a screencast), you can set your PS1
variable to change the prompt.
For example, if you want your prompt to be:
$
Then set your PS1
variable as follows on the terminal:
export PS1='$ '
Likewise, you can have it to whatever you want the prompt to look like. If you want the path to be displayed, set it as:
export PS1='\w '
For a permanent solution, you can set this in your shell configuration script, which is your ~/.bashrc
file in case you have bash as your shell.
If you frequently want to hide the terminal info temporarily, you can create a bash alias for this in the .bashrc
:
# anon - anonymous
alias anon='clear && export PS1="$ "'
And use the alias instead:
$ anon
To get back the terminal info, do (you can create an alias for this as well):
exec "$BASH"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With