LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-13-2009, 09:18 AM   #1
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Rep: Reputation: 37
bash profiles - Slackware 12.2


Hi guys,

I have been reading about making aliases permanent and other things and they all refer to this two files:

.bash_profile
.bashrc

the thing is that in my machine i dont find those two files anywere!!

I would have to create them myself, but im kind of wondering how do I get terminal colors by default when i use ls when i dont have bashrc or bash_profile...??

--EDIT--

I found out that there are two environment variables set...

1-
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:'
2-
Code:
LS_OPTIONS=' -F -b -T 0 --color=auto '
and then an alias as:

Code:
ls = ls $LS_OPTIONS

but i still dont get it why is that alias permanent if it is not set in any of the profile files.??

how can i make my own environment variables and aliases permanent?


thanks in advance guys!
 
Old 07-13-2009, 09:31 AM   #2
artistikone
Member
 
Registered: Jul 2003
Distribution: slackware-current
Posts: 76

Rep: Reputation: 15
If you don't have a ~/.bash_profile or /~.bashrc file created, it will pull from the defaults in /etc/profile instead. If you want to specify your own settings, create a ~/.bash_profile or ~/.bashrc and add to it.
 
Old 07-13-2009, 12:19 PM   #3
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
but i still dont get it why is that alias permanent if it is not set in any of the profile files.??
This is set in /etc/profile.d/coreutils-dircolors.sh which is called from /etc/profile. This file has already been mentioned and the way of making your own changes - by artistikone.

Have a look at "man bash" for information.
 
Old 07-14-2009, 01:00 AM   #4
crusader7
LQ Newbie
 
Registered: Dec 2008
Posts: 25

Rep: Reputation: 16
This site should have the answers to bash and adding colors.
http://humanreadable.nfshost.com/sdeg/
 
Old 07-14-2009, 03:35 AM   #5
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 291Reputation: 291Reputation: 291
To get colors in the bash terminal for my user_name, I just created a .bashrc file in my home directory and put this in it:
Code:
alias ll="ls -al --color"
alias ls='ls --color=auto'
export PAGER="most"
You will need to close and reopen the terminal for this to take effect.

Last edited by tommcd; 07-14-2009 at 03:38 AM.
 
Old 07-14-2009, 09:16 AM   #6
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
thanks for the help guys... is there anyway to customize the colors of ls ?

I saw that you used --color=auto where can i read about customizing that?
 
Old 07-14-2009, 09:28 AM   #7
Karu
Member
 
Registered: Jul 2007
Location: Estonia
Distribution: Slackware
Posts: 53

Rep: Reputation: 16
Googel search "LS_COLORS=" reveales some useful articles:
here and there.
 
Old 07-14-2009, 04:48 PM   #8
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by Karu View Post
Googel search "LS_COLORS=" reveales some useful articles:
here and there.
thanks for that, recently i have been reading a lot of Linux From Scratch and Advanced Bash Scripting, my mind is totally out.
 
Old 07-14-2009, 05:28 PM   #9
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
are you guys sure that it works in Slackware 12.2?

I just created a ~/.bashrc file with the following line:

export PS1="\e[0;32m(\t)\n\e[0;32m[\e[m\w\e[0;32m]\$ \e[m"

it doesnt load this file at all seems to be. nothing happened.

EDIT
---------------

never mind I created a .bash_profile with the same line and then it worked...

I dont get it thoughm, I thought that bash_profile was for log in shells only... or is it the other way around?

Last edited by RaptorX; 07-14-2009 at 05:30 PM.
 
Old 07-14-2009, 06:06 PM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,470
Blog Entries: 32

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
Hi,

Try this;

Quote:
#.bashrc
#08-30-06 12:20

# Add bin to path
export PATH="$PATH:$HOME/bin"

# Dynamic resizing
shopt -s checkwinsize

Custom prompt
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#08-29-06 11:40

if [ `id -un` = root ]; then
PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
else
PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
fi
#
# Add color
eval `dircolors -b`

# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias lsp='ls -1 /var/log/packages/ > package-list'
alias na='nano'
alias web='links -g -download-dir ~/ www.google.com'

#08-29-06 11:50

#To clean up and cover your tracks once you log off
#Depending on your version of BASH, you might have to use
# the other form of this command
trap "rm -f ~$LOGNAME/.bash_history" 0

#The older KSH-style form
# trap 0 rm -f ~$LOGNAME/.bash_history
For .bash_profile

Quote:
# .bash_profile
#08-30-06 12:21

# Source .bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
I think that I've posted these before. I'm on a new system and just happen to check out the FF. Moved these over from backup. They look OK.
 
Old 07-18-2009, 03:02 AM   #11
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
thanks for your help guys!
 
  


Reply


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
(bash) echo "#!/bin/bash" event not found - trying to generate profiles automatically jimieee Programming 9 05-03-2006 11:24 AM
bash probem slackware 10 sethgeekx86 Slackware 6 07-01-2004 02:04 PM
Slackware 8.1 bash rusification C.K Slackware 2 04-21-2003 06:12 PM
bash in slackware 8.1 chlee Linux - General 4 06-30-2002 07:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration