LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-10-2010, 04:00 AM   #1
mlpa
Member
 
Registered: May 2008
Location: Aveiro
Distribution: Slackware
Posts: 503

Rep: Reputation: 38
Terminal colours and locale


Hi everyone, I use slackware64 13.1. In my root account the terminal have colors for folders, files, etc and characters like appear correct.

I create a normal account for me, but specials characters don't appear and terminal have no colors.

I read in a lot that I need to configure a .bashrc and a .bash_profile but I don't found this files in my root account to get some guide lines.

Can someone explain this to me?
 
Old 09-10-2010, 05:51 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
Greetingz!

For starters, any file that begins with a dot (Example: ".filename") is typically excluded from the output when you run "ls". In order to see these 'hidden files' you have to use "ls -a" (see "man ls" for more options)

Side Note: Handy Aliases to put in your .bashrc or .bash_profile file
Code:
# List only hidden files & directories
alias l.='ls -A | grep ^.'
# List only directories
alias lD='ls -d */ 2>/dev/null'
# Long-Listing with Human-Readable sizes (GNU 'ls' required)
alias ll='ls -lhF'
# Long-Listing of hidden files & directories
alias ll.='ls -ld .??*'
# Long-Listing of only directories
alias llD='ls -l | grep ^d'
# 'Verbose' listing (for the Old School Slackers)
alias v='ls -lhF'
NOTE: You may want to check your current aliases (type "alias" at the command prompt) to see if the "ls" command itself is aliased with a few options. If not, then you can put an additional alias the top of the aforementioned block of text like so;
Code:
alias ls='ls --color=auto'
Now, the GNU "ls" command supports color via the "--color=auto" option. This looks for the Environment Variable LS_COLORS (which you can put in your .bashrc or .bash_profile to override the global setting).

Here's mine (note this has to be all one line):
Code:
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.bat=01;32:*.BAT=01;32:*.btm=01;32:*.BTM=01;32:*.cmd=01;32:*.CMD=01;32:*.com=01;32:*.COM=01;32:*.dll=01;32:*.DLL=01;32:*.exe=01;32:*.EXE=01;32:*.arj=01;31:*.bz2=01;31:*.deb=01;31:*.gz=01;31:*.lzh=01;31:*.rar=01;31:*.RAR=01;31:*.rpm=01;31:*.tar=01;31:*.taz=01;31:*.tb2=01;31:*.tbz2=01;31:*.tbz=01;31:*.tgz=01;31:*.tz2=01;31:*.z=01;31:*.Z=01;31:*.zip=01;31:*.ZIP=01;31:*.zoo=01;31:*.asf=01;35:*.ASF=01;35:*.avi=01;35:*.AVI=01;35:*.bmp=01;35:*.BMP=01;35:*.flac=01;35:*.FLAC=01;35:*.gif=01;35:*.GIF=01;35:*.jpg=01;35:*.JPG=01;35:*.jpeg=01;35:*.JPEG=01;35:*.m2a=01;35:*.M2A=01;35:*.m2v=01;35:*.M2V=01;35:*.m4a=01;35:*.M4A=01;35:*.m4p=01;35:*.M4P=01;35:*.m4v=01;35:*.M4V=01;35:*.mov=01;35:*.MOV=01;35:*.mp3=01;35:*.MP3=01;35:*.mpc=01;35:*.MPC=01;35:*.mpeg=01;35:*.MPEG=01;35:*.mpg=01;35:*.MPG=01;35:*.ogg=01;35:*.OGG=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.PNG=01;35:*.ppm=01;35:*.ram=01;35:*.RAM=01;35:*.rm=01;35:*.RM=01;35:*.tga=01;35:*.TGA=01;35:*.tif=01;35:*.TIF=01;35:*.tiff=01;35:*.TIFF=01;35:*.wav=01;35:*.WAV=01;35:*.wma=01;35:*.WMA=01;35:*.wmv=01;35:*.WMV=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.xwd=01;35:*.XWD=01;35
Note that some *NIX distributions have a "dircolors" file somewhere (usually in /etc)

Last edited by xeleema; 09-10-2010 at 05:55 AM.
 
Old 09-10-2010, 06:29 AM   #3
mlpa
Member
 
Registered: May 2008
Location: Aveiro
Distribution: Slackware
Posts: 503

Original Poster
Rep: Reputation: 38
My question is, what is the content of a .bashrc file and a .bash_profile file.
Where are they located, stuff like that.
 
Old 09-10-2010, 07:06 AM   #4
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
Quote:
Originally Posted by mlpa View Post
My question is, what is the content of a .bashrc file and a .bash_profile file.
Where are they located, stuff like that.
They're "hidden" files within each user's home directory. To see them, do an "ls -a". Note that the files are not required to exist, nor do you have to have both (you could create one, and symlink the other).

See the bash man page (man bash) if you're interested in the differences between .bashrc and .bash_profile.

As for what goes into them;

Short Answer: Nothing. The "Good Stuff" should be defined in the global profile files.

Long Answer: Anything.
A user can specify environment variables within their own .bashrc/.bash_profile file in order to override previously set "Global Defaults" (usually specified in /etc/bashrc or /etc/default/bashrc, check your *NIX distribution's documentation)

You can change the PS1 and PS2 shell prompts, define command aliases, setup custom environment variables.

It's also possible to setup the shell's command logging options via HISTFILE= HISTSIZE= and a few others.

Basically, if you took an autoexec.bat file, rolled it in ecstasy and dipped it in chocolate, that's what a .bashrc file is for. Only it's per-user.

Note: When a user calls you with a problem, check the time/date stamp on their shell's profile file (ksh uses .kshrc, csh uses .cshrc, bash can use .bashrc and/or .bash_profile). If the timestamp is recent, they !@#$%^-up their profile.

EDIT: To give you an idea of what's in one, here's my *extremely* customized .kshrc file (similar to a .bashrc/.bash_profile. It might even work if renamed)
*removed*

Last edited by xeleema; 09-10-2010 at 12:27 PM. Reason: Cut out my massive .kshrc - it didn't seem helpful after all.
 
Old 09-10-2010, 08:20 AM   #5
sahko
Senior Member
 
Registered: Sep 2008
Distribution: Slackware
Posts: 1,041

Rep: Reputation: Disabled
Quote:
Originally Posted by mlpa View Post
My question is, what is the content of a .bashrc file and a .bash_profile file.
Where are they located, stuff like that.
Slackware doesnt have those files by default. You need to create them yourself.
 
Old 09-10-2010, 09:40 AM   #6
mlpa
Member
 
Registered: May 2008
Location: Aveiro
Distribution: Slackware
Posts: 503

Original Poster
Rep: Reputation: 38
A .bashrc with
Quote:
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# List folders and files with colors
alias ls="ls --color=auto"
is enough? No need for .bash_profile?

And about locale? I think I use en_GB and don't appear correct, but in root account works?

Last edited by mlpa; 09-10-2010 at 08:21 PM.
 
  


Reply

Tags
bashrc, colors, special


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What terminal or shell colours do you use? jayeola Linux - General 2 08-24-2010 08:16 AM
Questions about su, su -, shells and terminal colours Nylex Linux - General 4 08-13-2005 03:59 AM
What do the colours mean in the terminal? alaskazimm Mandriva 2 07-04-2004 08:34 AM
No .bashrc, I need colours in the terminal!! akudewan Slackware 9 06-07-2004 05:16 PM
How do I get colours in terminal (aterm)? mr-tiddles Linux - General 5 10-23-2003 11:23 AM


All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration