LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bash: Help with configuration of shell (https://www.linuxquestions.org/questions/linux-software-2/bash-help-with-configuration-of-shell-4175599759/)

TheStr3ak5 02-14-2017 02:21 PM

Bash: Help with configuration of shell
 
Hi friends, i will explain myself, the tittle ik is a little bad formuled.
I am making a linux system from scratch following half lfs and blfs book and half other sources.
When i boot in the system and choose the user i have a problem (only stetic, nothing funcional), in most distros when you start terminal it puts the user and the hostname of the pc, but in my chase only puts the name of the shell (in my chase bash and the version), i have searched about it and revised both /.bashrc and profile files of the shell to find the problem but it doesnt seems bad.
Someone knows how to fix it? Thanks in advance and sorry if it is bad explained, i´m not very good at english.

wpeckham 02-14-2017 02:27 PM

Quote:

Originally Posted by TheStr3ak5 (Post 5670529)
Hi friends, i will explain myself, the tittle ik is a little bad formuled.
I am making a linux system from scratch following half lfs and blfs book and half other sources.
When i boot in the system and choose the user i have a problem (only stetic, nothing funcional), in most distros when you start terminal it puts the user and the hostname of the pc, but in my chase only puts the name of the shell (in my chase bash and the version), i have searched about it and revised both /.bashrc and profile files of the shell to find the problem but it doesnt seems bad.
Someone knows how to fix it? Thanks in advance and sorry if it is bad explained, i´m not very good at english.

Examine the bash man page and look for discussion of the PS1 and PS2 variables.
Now check the startup files under /etc, etc/profile.d, and those under the users home to find where these are set. Ones you change under /etc change them for all users on the server, so take care. Changing those under the users home only affect that user, so there is less risk.

Turbocapitalist 02-14-2017 02:37 PM

Agreed. Finding the mentions of the PS1 and PS2 variables in the bash manual will get you far. The fun stuff, including a lot of abbreviations, is in the section PROMPTING.

Code:

man bash

szboardstretcher 02-14-2017 02:38 PM

Typical PS1 on a centos system is:

Code:

[\u@\h \W]\$
which looks like

Quote:

[root@centos-box ~]#

MadeInGermany 02-14-2017 02:54 PM

The default prompt for bash is e.g "bash-3.2$ " for lusers and "bash-3.2# " for root, where 3.2 is the bash version.
So there is nothing wrong with it.
Some distros set a user@hostname prompt in /etc/profile and /etc/bash.bashrc, they run before the user's .profile and .bashrc, respectively.
If your distro does not, then the administrator can provide it in the /etc/ files for all users on the system, or each user can do it in her .profile and .bashrc files.
If you go for the /etc/ files: some distros have them run /etc/profile.d/*.sh files, then you simply add a .sh file with the desired prompt. Some distros provide optional shell packages with files in /etc/profile.d/, so please check before you re-invent the wheel.

TheStr3ak5 02-15-2017 10:25 AM

Thanks all for that really quick reply, i throught it will cost around 2 days to get a answer about this kind of specific issues.
I saw all replies and all aported a lot of info about the config, just modified the PS1 variable in /etc/profile with the PS1 content of szboardstretcher and started to see color in my screen, then revised the files of /skel/ and actualized it in the directory and in the home folders of all users ,modifing it with the new variables and advices with you sayed and all started work fine!, the only problem i have now is that i need to make the system bootable using GRUB, but that is other story, and i dont expect any problems about it, thanks all!

pan64 02-15-2017 01:44 PM

you can try something like this too: https://www.kirsle.net/wizards/ps1.html


All times are GMT -5. The time now is 12:05 PM.