How to edit the user and host displayed in the terminal?
772
I am currently using Fedora for the first time, and I have the problem that the terminal's own data is very long
What would be the correct way to shorten all the information displayed? Was I thinking of a solution like the one used by the Parrot OS terminal, or some other elegant solution?
Open the configuration file .bashrclocated in the homewith the editor of your choice. You can do it from the terminal using:
code ~/.bashrc # Para editarlo con Vscode
nano ~/.bashrc # Para abrirlo con nano
Find the line that starts with PS1=. The line should look similar to PS1='[\u@\h \W]$ 'where \uit represents the username, \hit represents the host and \Wyour current location on the computer. Just this line is the one that defines the user format in the console, and it is the one that you must edit. Change it to:
PS1='[\W]\$ 'to display only the name of the directory you are in. Something like:
[Desktop]$
PS1='\$ 'to display only the dollar sign $:
$
Or customize it however you like.
Finally save the changes in the file and execute in terminal the command source ~/.bashrcto load the changes you saved. With this you should already see the change in the console.
Steps to change user and host in bash
.bashrc
located in thehome
with the editor of your choice. You can do it from the terminal using:PS1=
. The line should look similar toPS1='[\u@\h \W]$ '
where\u
it represents the username,\h
it represents the host and\W
your current location on the computer. Just this line is the one that defines the user format in the console, and it is the one that you must edit. Change it to:PS1='[\W]\$ '
to display only the name of the directory you are in. Something like:PS1='\$ '
to display only the dollar sign$
:Or customize it however you like.
source ~/.bashrc
to load the changes you saved. With this you should already see the change in the console.You can check more details at https://www.maketecheasier.com/remove-user-hostname-terminal-prompt/ .