View previous topic :: View next topic |
Author |
Message |
NicZak n00b
Joined: 21 Apr 2002 Posts: 29
|
Posted: Mon Apr 22, 2002 5:55 pm Post subject: customizing bash.. ? |
|
|
Without using a x terminal emulator, or similar how can I get my shell to use color coding (for lack of a better term) ? I am somewhat used having 'ls' give me an output with directories showing up as a different color as files or at least with a / after their name. It is sometimes confusing when doing file management in a shell (mc, i know i know) when what you thought was file is a directory and vice-versa. In short, is there a way to customize bash scripts to display different items differently, or an 3rd party program to accomplish this same task? On a sidenote, can I add a PATH=.....:....:.... in my /home/username/.bash_profile to specify user paths? Thanks - |
|
Back to top |
|
|
gilgames n00b
Joined: 18 Apr 2002 Posts: 12 Location: Edam - The Netherlands
|
Posted: Mon Apr 22, 2002 6:18 pm Post subject: Re: customizing bash.. ? |
|
|
I use this in my .bash_profile (not really but it's sourced from there)
Code: |
eval `dircolors -b`
alias ls='ls --almost-all'
alias l='ls --color'
alias ll='l --format=long'
alias dir='ll'
|
This is reasonably standard I believe(meaning: I just copy&pasted creatively) and you might want to do Code: | LESS=--raw-control-chars | somewhere too(if you use LESS ofcourse.
HTH |
|
Back to top |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Mon Apr 22, 2002 6:23 pm Post subject: |
|
|
In your home directory, create a file called ".bash_profile" (or edit it if it already exists) In the file, put the following line:
Code: | alias ls='ls --color=always' |
That will tell bash to substitute ls --color any time you type ls.
You'll need to log out and log back in for this to take effect.
--kurt _________________ The problem with political jokes is that they get elected |
|
Back to top |
|
|
vert Apprentice
Joined: 07 May 2002 Posts: 214 Location: Delft, The Netherlands
|
Posted: Sun May 12, 2002 10:40 am Post subject: |
|
|
I have a file called ".bash_profile" in the home dir and it says:
Code: |
#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ] && . ~/.bashrc
eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
|
Still I will not work I tried putting 'always' instead of 'auto', no luck. If I do ls --color in the console, it does work. What am I missing here? (and yes, I did log out and back in )
And while I'm at it, where gets the .bash_profile copied from when a new user is added?
THNX! |
|
Back to top |
|
|
tomte Tux's lil' helper
Joined: 08 May 2002 Posts: 122
|
Posted: Sun May 12, 2002 11:45 am Post subject: |
|
|
vert wrote: |
And while I'm at it, where gets the .bash_profile copied from when a new user is added?
THNX! |
hth, tom |
|
Back to top |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Sun May 12, 2002 11:47 am Post subject: |
|
|
vert wrote: | I have a file called ".bash_profile" in the home dir and it says:
Code: |
#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ] && . ~/.bashrc
|
|
Do you have a .bashrc file as well? If not, that might be causing the problem. Try the following code instead:
Code: | # include .bashrc if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi |
vert wrote: | where gets the .bash_profile copied from when a new user is added? |
/etc/skel
Also, I'm away from my Gentoo box at the moment, but I think there should be some bash examples in:
Code: | /usr/share/doc/bash/examples/startup-files |
Might check there to see if that's of any help.
--kurt _________________ The problem with political jokes is that they get elected |
|
Back to top |
|
|
ShadowIce n00b
Joined: 12 May 2002 Posts: 20 Location: Germany
|
Posted: Sun May 12, 2002 9:23 pm Post subject: |
|
|
Are you sure you are using bash as you shell? I had nearly the same problem and that was because I didn't specify a shell when adding a new user and the default was sh. _________________ Go on, prove me wrong. Destroy the fabric of the universe. See if I care.
-- Terry Pratchett |
|
Back to top |
|
|
vert Apprentice
Joined: 07 May 2002 Posts: 214 Location: Delft, The Netherlands
|
Posted: Sun May 12, 2002 10:14 pm Post subject: |
|
|
I'm pretty sure its bash. How can I check?
And I do have a .bashrc Its empty though (excep for some comments).
And still no color |
|
Back to top |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Sun May 12, 2002 11:01 pm Post subject: |
|
|
vert wrote: | I'm pretty sure its bash. How can I check? |
Look in your /etc/passwd file and find the username in question. If it's a bash shell, you should see something like:
Code: | username:x:1000:1000:Full Name,,,:/home/username:/bin/bash |
With the '/bin/bash' part being the key.
--kurt _________________ The problem with political jokes is that they get elected |
|
Back to top |
|
|
FlyingCow n00b
Joined: 11 May 2002 Posts: 2 Location: Bavaria / DE
|
Posted: Sun May 12, 2002 11:08 pm Post subject: set bash as default shell |
|
|
By the way ... as root, you can set the default shell with Code: | usermod -s /bin/bash someuser | .
That way, no don't need to edit the /etc/passwd file |
|
Back to top |
|
|
vert Apprentice
Joined: 07 May 2002 Posts: 214 Location: Delft, The Netherlands
|
Posted: Mon May 13, 2002 11:49 am Post subject: Re: set bash as default shell |
|
|
FlyingCow wrote: | By the way ... as root, you can set the default shell with Code: | usermod -s /bin/bash someuser | .
That way, no don't need to edit the /etc/passwd file |
I did that, so its bash all right
Other suggestions as to why the --color isn't working? |
|
Back to top |
|
|
fuzz Tux's lil' helper
Joined: 23 Apr 2002 Posts: 93
|
Posted: Mon May 13, 2002 11:55 pm Post subject: |
|
|
is there a way to give the folders a diferent color other than blue |
|
Back to top |
|
|
|