LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Terminal and Shell Configuration (https://www.linuxquestions.org/questions/linux-software-2/terminal-and-shell-configuration-210938/)

systemparadox 07-29-2004 04:01 AM

Terminal and Shell Configuration
 
Hi,
Just a few things that are really annoying me...

On the console...
1. How do I make bash the default shell for new users (currently it is sh)?
2. Where are the default settings stored (ie for things like alias)?
3. I have put a .bashrc in my home dir which adds some more aliases. When I log in they are not there ('echo $SHELL' shows the shell to be bash), but if I then run bash (inside itself), the new aliases appear. How do I fix this?

In aterm (actually in any terminal)...
4. What is it called when the prompt is "user@host:dir$"?
5. All of my terminals only give me a "bash-2.05b$" prompt- how can I get the above instead?

Thanks in advance
Simon

bestofmed 07-29-2004 04:16 AM

in modern Linuxes sh is just a link to bash so you dont have to bother yourself.
Your setting will be stored in you home dir in file named .bash_profile

try typeing the following to change the prompt

Code:

export PS1="\u@\h:\w$"
I'm not sure about the escape chars but give it a try it shall work.


You can sutomize the shell prompt by changing the variable $PS1. Plz look at the bash info page for more infromation on $PS1 variable.

mikshaw 07-29-2004 08:58 AM

3. I have put a .bashrc in my home dir which adds some more aliases. When I log in they are not there ('echo $SHELL' shows the shell to be bash), but if I then run bash (inside itself), the new aliases appear. How do I fix this?
---
.bashrc is not read from a login shell by default. To fix this, add the following to $HOME/.bash_profile:

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

systemparadox 07-30-2004 08:32 AM

Thanks,
One more thing thats annoying me...
Aterm (and xterm and rxvt) puts all coloured text in bold- I use a small font and it makes it very unclear- how can I stop the terminals from doing this?

systemparadox 08-12-2004 11:55 AM

Surely someone knows how to stop the terminals from putting all coloured text in bold- your help would be greatly appreciated.

Thanks
Simon

Dark_Helmet 08-12-2004 12:48 PM

I can tell you how Red Hat does it. You might have to investigate if your distros do it differently.

Essentially, the global bash configuration (/etc/profile) executes every script in /etc/profile.d. In that directory, there are a number of scripts, with one of them named colorls.sh. That script looks for a color definition file. It defaults to a global one, and then overrides that location if it finds a better one (in your home directory for instance). Then it executes the commands to create the colors in commandline utilities.

What you're interested in is finding and editing the color definition file. For Red Hat, it looks for /etc/DIR_COLORS (as a default), and proceeds to look at your home directory for .dircolors or .dir_colors (along with some other gyrations based on the terminal type). Find the one the system is using, and modify it or copy it to your home directory. Open up a text editor, and scroll through the file. You'll see lots of numeric codes sprinkled throughout. For example, in my global definition file:
Code:

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00        # global default, although everything should be something.
FILE 00        # normal file
DIR 01;34        # directory
LINK 01;36        # symbolic link
FIFO 40;33        # pipe
SOCK 01;35        # socket
BLK 40;33;01        # block device driver
CHR 40;33;01        # character device driver
ORPHAN 01;05;37;41  # orphaned syminks
MISSING 01;05;37;41 # ... and the files they point to

As the comments at the top state, to make something bold, add a 01. To get rid of bold, just delete that same code.

You'll likely have to log out for the changes to take effect.


All times are GMT -5. The time now is 11:09 AM.