I'm trying to find the Slackware equivalent to bashrc
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to find the Slackware equivalent to bashrc
I'm in my /etc directory trying to find what file would be the equivalent of bashrc in slackware. I want to setup some custom aliases and functions, and I understand that bashrc was meant for this?
I dont see it in my home directory. I'm in the home directory of my basic user account.
Edit: I see. Ok I didn't know I had to create the file. You've gotten me on the right track. I was using /etc/profile and got a bit confused when I learned about the bashrc.. Thanks guys.
/etc/profile does only apply to login shells, and wont be used for a VT ie. xterm. Near the end of 'man bash' there is a description of all bash files.
I had to add this code to etc/profile but I'm not sure why... I mean, I know what it does but I dont quite get it. I vaguely understand the first part.. I'm guess it checks in the home directory for bashrc. The highlighted statement is what's throwing me off.
The code is to allow the /etc/profile to read the bashrc, but I dont know why and trying to understand it, as I'm currently learning shell scripting.
I'm in my /etc directory trying to find what file would be the equivalent of bashrc in slackware. I want to setup some custom aliases and functions, and I understand that bashrc was meant for this?
You would create your '.bashrc and .bash_profile' in the user home directory with your favorite text editor, vi of course.
My root .bash_profile;
Code:
~# cat .bash_profile
# .bash_profile
#08-30-06 12:21 gws copied loki:/root
#06-27-07 13:10 gws copied from odin for willi
#
# Source .bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
My root .bashrc;
Code:
~# cat .bashrc
#.bashrc
#08-30-06 12:20 gws copied loki:/root
#
#06-27-07 13:06 gws added from odin for willi
#
# Add bin to path
export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"
#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 gws
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 gws
#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
You can custom for each user if so desired;
Code:
#.bashrc
#08-30-06 12:20 gws copied loki:/root
#
#06-27-07 13:06 gws added from odin for willi
#
#06-27-07 13:14 gws added from oden:root to /home/gws/.bashrc
# Add bin to path
export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"
#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 gws
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 gws
#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
The code is to allow the /etc/profile to read the bashrc, but I dont know why and trying to understand it, as I'm currently learning shell scripting.
Basic bash - as suggested, try "man bash".
It's checking if the bashrc exists, then executing it. That leading "." is very significant. Also known as "source" - check that manpage. BTW, you can search in man with "/" (e.g. /source) - "n" will get the next occurence; should all be in the manpage ...
I'm in my /etc directory trying to find what file would be the equivalent of bashrc in slackware. I want to setup some custom aliases and functions, and I understand that bashrc was meant for this?
Login shell doesn't use ~/.bashrc (only virtual terminal like xterm or konsole do). You need that code only if you wish that your login shell would execute commands in .bashrc.
To be honest I understand some of this stuff but a lot of it is foreign grounds. I'm a novice... and also a bit impatient, and that's something I'm working on. The impatience is part of the reason why I'm still a novice.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.